我正在尝试使用 PInvoke 绑定此 C 函数。
bool GuiTextBox(Rectangle bounds, char *text, int textSize, bool editMode);
这是 PInvoke 签名。
[DllImport(nativeLibName,CallingConvention = CallingConvention.Cdecl)]public static extern bool GuiTextBox(Rectangle bounds, string text, int textSize, bool freeEdit);
当我尝试使用它时,字符串不会被修改。我尝试将它作为 ref 传递,但是当我尝试使用它时它会因尝试读取或写入受保护的内存而崩溃。
临摹微笑
相关分类