c++ - Importing DLL functions in c# code -


i have dll, functions want use in c# code here functions of dll :

extern "c" {   __declspec(dllimport)   const char* __stdcall zajsonrequesta(const char *szreq);    __declspec(dllimport)   const wchar_t* __stdcall zajsonrequestw(const wchar_t *szreq);    __declspec(dllimport)   const bstr __stdcall zajsonrequestbstr(bstr sreq); } 

can tell me how use in c# project, dll seems in other language ?

please have @ following article on code project in depth explanation

a small sample linked article shown below

to call function, methodname

int __declspec(dllexport) methodname(int b) {       return b; } 

include class library (methodnamelibrary.dll) containing above method shown below in c#

class program {    [dllimport(@"c:\methodnamelibrary.dll")]    private static extern int methodname(int b);    static void main(string[] args)    {        console.writeline(methodname(3));    } } 

Comments

Popular posts from this blog

android - getbluetoothservice() called with no bluetoothmanagercallback -

sql - ASP.NET SqlDataSource, like on SelectCommand -

ios - Undefined symbols for architecture armv7: "_OBJC_CLASS_$_SSZipArchive" -