The C DLL has the following declaration:
ExternC int4 STDCALL func( char * ); // -> array of 32 byte strings
I can call it from C++ code using [this works!]:
char str[32] = "My String";
int4 result = func( str );
Now, I need to do this in C#. I tried something like this, but it won't
compile ("Specified unmanaged type is only valid on fields."):
[ DllImport( "capi.dll", EntryPoint = "func" ) ]
public static extern int CSharpFunc( [MarshalAs (UnmanagedType.ByValTStr,
SizeConst=32)] string s );
I realize that this isn't the way it should be done, but those of you with
experience of marshalling different types of string representations should