Marshalling an argument of "char*" using IJW metho

  • Thread starter Thread starter halise
  • Start date Start date
H

halise

hello,

i am trying to wrap an unmanaged C++ code to managed one so that i can
use it within c#, and i am using IJW - "It Just Works" - method for
that. In the code, there is a function which takes a "filename" as
one of its arguments and the type of that is "char*". In the
documents of msdn, "char*" is mapped to String or
StringBuilder[in,out] by marshaller. although i searched in the
goggle, i couldnt find any kinds of simple-because I am not an
experienced enough- sample code that uses IJW method. I found always
the ones which uses PInvoke method.

Can anyone help me with marshalling "char*" type with IJW method by a
simple sample code?

Thanks!

*-----------------------*
Posted at:
www.GroupSrv.com
*-----------------------*
 
Can anyone help me with marshalling "char*" type with IJW method by a
simple sample code?

You may want to post to microsoft.public.dotnet.languages.vc instead.

But if you get a managed String as input from the C# caller, you
typically pin it, then use the pinning pointer as an LPWSTR and use
for example WideCharToMultiByte to convert it to an ANSI string.



Mattias
 
Back
Top