I have c++ dll with class in wich I want to send string from C# code, surly I can’t use string because of CLR, i’ll stried to change string into char in c++ dll, and send byte from c#(because c++ char=byte in c#) but c# don’t understand c++ array I can send 1 byte and it will be ok, but not array, please help!
dll Code:
public ref class Coding
{
public:
void HillCoding(char filePath[])
{
...
}
};
Here is the working code of calling C++ dll function from C#:
It’s not the “very good code” but it illustrate what you need.
PS: Here is ArrayConvCtoSB. I do not like it, it’s just for understanding.
PPS: “fixed” is strongly required for forceing garbage collector not to clear the SB_array memory: otherwise it can. 🙂