I am doing a dllImport on a C++ dll and I have the following signature. StackOverflow has been very helpful so far, so I thought I’d throw this one and see what I get.
Are there any gotchas that I should be worried about? This is my first time using dllimport.
I need to import the following to C#:
HANDLE FooInit(char* name); //name appears to be a string like ‘COM1’
int Foo1(HANDLE handle, const char** sentence); //sentence appears to be a string like ‘Hello World’
int Foo2(HANDLE handle, DWORD* val);
Thanks very much!
Check out the P/Invoke Cheat Sheet (not complete, but a quick reference). char * usually becomes string. const char ** is trickier as I can’t tell by looking at it whether it’s a pointer to a single string or an array of strings.