Search code examples
c#c++native-methods

How to Call C++ Native Properity from C#


I'm not that good in C++ but,.. For example I have this

#define GETSomthing_API  __declspec(dllexport)
extern GETSomthing_API int nGetSomthing;

And the method I want to import like this

GETSomthing_API  int GetSomthing(const char* szConfigPath, char *A, int B)

How Can I call this from C# ?

Beside, I think my problem is with the parameter type (const char* ) in C++ side, what is the equal type in C# for it! const char*

Thanks,


Solution

  • How to call C++ code from C#

    or

    Calling C++ function from C#

    Using: [DllImport("xxx.dll")] xxx.dll is compile by C++

    Hope this help.