我正在写阿玛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