R
raludamian
Hello!
Sorry if I bring up again a problem that perhaps has already been
discussed...
I don't really understand how to pass strings as parameters between a
native C++ dll and a managed C# application.
The C++ code looks like this:
extern "C" void __declspec(dllexport) __stdcall
UTIL_OGRWriteDraw(double x, double y, char szName[33]);
and the C# code:
[DllImport("gdalce.dll")]
public static extern void UTIL_OGRWriteDraw(double x, double y, byte[]
bMessage);
and I try to use it like this:
....
byte[] bMessage = ASCIIEncoding.ASCII.GetBytes(message);
UTIL_OGRWriteDraw((double)xMouse, (double)yMouse, bMessage);
....
The C# app should send a message to the C++ dll but the problem is
that I only get the first letter of the message... The same happens if
I use char[] instead of byte[]... And I understand that .NET CF does
not support [MarshalAs...]
Any suggestions? I really would appreciate any help or advice you
could give me...
Thank you!
Raluca
Sorry if I bring up again a problem that perhaps has already been
discussed...
I don't really understand how to pass strings as parameters between a
native C++ dll and a managed C# application.
The C++ code looks like this:
extern "C" void __declspec(dllexport) __stdcall
UTIL_OGRWriteDraw(double x, double y, char szName[33]);
and the C# code:
[DllImport("gdalce.dll")]
public static extern void UTIL_OGRWriteDraw(double x, double y, byte[]
bMessage);
and I try to use it like this:
....
byte[] bMessage = ASCIIEncoding.ASCII.GetBytes(message);
UTIL_OGRWriteDraw((double)xMouse, (double)yMouse, bMessage);
....
The C# app should send a message to the C++ dll but the problem is
that I only get the first letter of the message... The same happens if
I use char[] instead of byte[]... And I understand that .NET CF does
not support [MarshalAs...]
Any suggestions? I really would appreciate any help or advice you
could give me...
Thank you!
Raluca