Andre,
The problem is that you are delcaring the method in C++ as a pointer,
and not a managed array (the concepts are different in the managed world).
You want to declare your function like this:
Class::Func(char Text __gc[])
This syntax will change with the next version of .NET (at least, in
C++). Also, if you want to pass a string, why not use the string class,
like so:
Class::Func(String *Text)
Hope this helps.
--
- Nicholas Paldino [.NET/C# MVP]
-
mv*@spam.guard.caspershouse.com
"Andre" <sk******@gmx.de> wrote in message
news:be**************************@posting.google.c om...
Hi,
I have a problem with calling a managed C++ function from C#.
The function in C++ looks like Class::Func(char* Text)
this function is compiled to an DLL and this DLL is referenced in my
C# project and I can see that I could call this function like
Func(sbyte* ).
I created a sbyte[] mytext = new sbyte[20];
So how can I pass this to the C++ function?
The compiler always give me an compileerror that it cannot convert
from sbyte* and sbyte[].
Thanks
André Betz
http://www.andrebetz.de