EXPORT void WINAPI sanSetCustomerIdentifier(const char* name)
{
FILE* stream;
errno_t err;
err = fopen_s(&stream, "c:\\temp\\customerIdentifier.txt", "w+");
fprintf(stream, name);
err = fclose(stream);
SanSetCustomerIdentifier(name);
}
====================== C#
public void SanSetCustomerIdentifier(string customerIdentifier)
{
if (dllHandle == IntPtr.Zero) return;
sanSetCustomerIdentifier(customerIdentifier);
}
[DllImport(TranslatorDllName, CharSet = CharSet.Ansi)]
private static extern void sanSetCustomerIdentifier(string customerIdentifier);
TEEEAAAM Ř, Č, 汉字 - !#$@$%^() - global => TEEEAAAM R, C, ?? - !#$@$^() - global
[DllImport(TranslatorDllName, CharSet = CharSet.Unicode)]
private static extern void sanSetCustomerIdentifier(string customerIdentifier);
TEEEAAAM Ř, Č, 汉字 - !#$@$%^() - global => D
Надо ещё указывать как маршалить стринг https://www.codeproject.com/Articles/66244/Marshaling-with-C-Chapter-2-Marshaling-Simple-Type
Обсуждают сегодня