1

现有应用程序将导入我的类库。我正在尝试在 C# 中执行此操作,因为我在 C# 方面的经验比 C++ 多得多。现有的应用程序使用 __stdcall,这在 C# 中是不可能的,因为代码是托管的。我使用一个名为 RGiesecke.DllExport 的库来执行非托管导出。

[DllExport("LibraryOpen", CallingConvention = System.Runtime.InteropServices.CallingConvention.StdCall)]
static int LibraryOpen(int* session, char* description)
{
    //I need to fill description here.
}

我有一个 C/C++ 中函数的示例头

typedef int (__stdcall *LibraryOpen)(int *session, WCHAR *description);

这个函数的目的是,我用我的库的简短描述填充描述指针。

问题是我不确定 char* 在这里是否很好用,而且我不知道如何用字符串填充这个指针。

我希望有人可以帮助我,在此先感谢您。

4

0 回答 0