[Mono-dev] Marshalling wchar_t

Rajesh Gupta Rajesh.Gupta at actividentity.com
Wed Jan 17 20:03:52 EST 2007


            I am trying to call a c++ shared library and the specifics
of the call are as follows:


On the C++ end, I have a function like so:


authenticate(WINID window, struct ModuleAndType *modules[],

            int size, const wchar_t* inToken, wchar_t** outToken)


On the C# end, I have the following:



private static extern uint authenticate(

            int hwnd,


            ref ModuleAndType[] modules,

            int size,


            string inToken,


            ref string outToken);


This works fine under windows, but I am getting junk characters when
running the same code

In Suse Linux 10.0. I have Mono JIT intalled. After initial
searching on the

Internet, I read that it was due to the number of bytes used by wchar_t
in Windows and

Linux. Mono seems to be marshalling it like windows wchar_t even on
Linux and thus the

junk characters. Is there a way I can get wchar_t to work through


Thanks in advance for your help,






-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.ximian.com/pipermail/mono-devel-list/attachments/20070118/4e1c5f6c/attachment.html 

More information about the Mono-devel-list mailing list