B
ba.hons
Hello,
I have started to use an old WIN32 API to develop an application and
am having trouble executing one of the DLL's methods.
int ContactController(char *ipHostName, int port)
I have my code as follows:
[DllImport("MYDLL.dll", SetLastError = true, CharSet =
CharSet.Auto)]
static extern int
ContactController([MarshalAs(UnmanagedType.LPStr)]String test,
int Port);
I have also tried
[DllImport("MYDLL.dll", SetLastError = true, CharSet =
CharSet.Auto)]
static extern int ContactController(String test,
int Port);
Unfortunately i dont receive an exception only an Integer which is
returned from the method.
I presume i am not marshalling the char* correctly.
Anyone with any help would be appreciated!
Thanks
Adam
I have started to use an old WIN32 API to develop an application and
am having trouble executing one of the DLL's methods.
int ContactController(char *ipHostName, int port)
I have my code as follows:
[DllImport("MYDLL.dll", SetLastError = true, CharSet =
CharSet.Auto)]
static extern int
ContactController([MarshalAs(UnmanagedType.LPStr)]String test,
int Port);
I have also tried
[DllImport("MYDLL.dll", SetLastError = true, CharSet =
CharSet.Auto)]
static extern int ContactController(String test,
int Port);
Unfortunately i dont receive an exception only an Integer which is
returned from the method.
I presume i am not marshalling the char* correctly.
Anyone with any help would be appreciated!
Thanks
Adam