我正在寫阿瑪3.擴展通常情況下,你可以簡單地寫一個C++庫,這和剛剛實現這個功能元帥爲const char **
int __stdcall RVExtensionArgs(char *output, int outputSize, const char *function, const char **args, int argCnt);
我正在開發一個C#庫,我想把它實現這個功能。功能RVExtensionArgs
具有修飾名是[email protected]
爲32位和RVExtensionArgs
64位
我正在與指針args參數的常量字符的指針掙扎。我當前的實現是
#if WIN64
[DllExport("RVExtensionArgs", CallingConvention = CallingConvention.Winapi)]
#else
[DllExport("[email protected]", CallingConvention = CallingConvention.Winapi)]
#endif
public static int RvExtensionArgs(StringBuilder output, int outputSize,
[MarshalAs(UnmanagedType.LPStr)] string function,
[MarshalAs(UnmanagedType.LPArray, SizeParamIndex = 4, ArraySubType = UnmanagedType.LPStr)] string[] args,
int argCount)
的DLLEXPORT使用的是從UnmanagedExports
有關於在here
擴展,但這樣的遊戲崩潰的一些信息。我很確定這是因爲參數,但我無法驗證它。我錯過了什麼嗎?
你會得到任何異常信息嗎? – pquest
可悲的是,沒有有用的調試信息。在這種情況下,我無法調試任何東西,因爲dll是從遊戲加載的,當然遊戲無法調試。我也實現了正常的RVExtension(可以在維基頁面找到我鏈接),這工作正常。 – chris579
將它導入一個不安全的類中會不會更簡單和更高性能:byte * output,int outputSize,byte * function,byte ** args,int argCnt將猜測帶出編組?唯一的「挑戰」是將.NET字符串中的UTF-16字符轉換爲字節。 – hoodaticus