Class of C++ to be used in C#
-
I created a class in Visual C++.NET 2005 and I tried to use it in C#.NET 2005 I have a function in the class that has a parameter of char * and in C# it is seen as sbyte * I was wondering what's the difference ? And how can I make C# see the char * variable as char * so that it can be used as a string. If it isn't possible, please suggest alternatives. Thanks, Clint
-
I created a class in Visual C++.NET 2005 and I tried to use it in C#.NET 2005 I have a function in the class that has a parameter of char * and in C# it is seen as sbyte * I was wondering what's the difference ? And how can I make C# see the char * variable as char * so that it can be used as a string. If it isn't possible, please suggest alternatives. Thanks, Clint
C++ classes are not compatible with C#. However, you can call a specific function using P/Invoke. Just search for it. Alex Korchemniy
-
I created a class in Visual C++.NET 2005 and I tried to use it in C#.NET 2005 I have a function in the class that has a parameter of char * and in C# it is seen as sbyte * I was wondering what's the difference ? And how can I make C# see the char * variable as char * so that it can be used as a string. If it isn't possible, please suggest alternatives. Thanks, Clint
In C++ the char datatype is a signed byte. In C# the char datatype is a Unicode character, e.g. a 16 bit data type. You have to decode the C++ string from whatever encoding it uses. Look in the System.Runtime.InteropServices namespace if there is something built-in that does this. --- b { font-weight: normal; }
-
In C++ the char datatype is a signed byte. In C# the char datatype is a Unicode character, e.g. a 16 bit data type. You have to decode the C++ string from whatever encoding it uses. Look in the System.Runtime.InteropServices namespace if there is something built-in that does this. --- b { font-weight: normal; }