Is it possible to declare different charset options for seperate params?
heres what i mean:
[dllimport(\"my.dll\", charset = charset.Ansi)]
void myfunc(s
You should specify [MarshalAs] for each parameter.
Try the following:
[DllImport("my.dll")]
void myfunc(
[MarshalAs(UnmanagedType.LPStr)] string CharPtrInCPP,
[MarshalAs(UnmanagedType.LPWStr)] StringBuilder WCharPtrInCPP,
int len
);
As already pointed out, you should be able to specify MarshalAs for each parameter. Another way would be to specify a default character set type and then specify the marshalling for the odd one out. For example,
[DllImport("my.dll", CharSet=CharSet.Unicode)]
void myfunc( [MarshalAs( UnmanagedType.LPStr )] String filename,
StringBuilder buffer, int len );