Hello,
I'm trying to marshall unsigned char** (which is in a C++ interface) in order to call the method from C#.
How can this be done? Is there a list where are C++ data types and C# data types?
Thanks!
Hello,
I'm trying to marshall unsigned char** (which is in a C++ interface) in order to call the method from C#.
How can this be done? Is there a list where are C++ data types and C# data types?
Thanks!
That would be marshalable as ref string
. Be sure to use the right character set with a [MarshalAs]
attribute.
What is the semantics of this unsigned char**
? If it is a byte array, use ref byte[]
.
If it is a zero terminated string, use ref string
.
You can find some popular method signatures mapped to c# on the page http://www.pinvoke.net, which may give you the idea.
I think you should use a serialization library that has an interface for both C++
and C#
.
Both Protocol Buffers from Google or Thrift from Facebook support these two languages.
It would definitely make things much easier and safer for you.
If you decide to change the transferred data types (i.e. use integers, structures, etc. instead of raw strings), using a serialization library is the way to go.