I have a win32 native dll (perhaps that's not the correct term - it's basically a C compiled dll) that I'm accessing in C#. The method signature of the C code (not the actual signature in the dll):
I'd like to access the char* as a byte in C#. I know how to access the char* as a string in C#:
[DllImport("DLLTest.dll")] public static extern String ImportedTestMethod();
The main reason I want to do this is because the char* output is encoded in UTF-8. If I get the actual bytes in C# then it's a simple matter to interpret them correctly and store it in the usual UTF-16 C# string.
Any ideas or workarounds? I can convert the C# string (from the above code) to a byte and interpret the encoding correctly but that seems very inefficient.
Thank you for your time and assistance :)