如何从Excel VBA中调用DLL函数返回string?
我有一个C编译的编译DLL,导出这个函数:
__stdcall const char *GetVersion() { return "1.0.2"; }
我试图从Excel VBA中调用该函数。 我宣布如下:
Private Declare PtrSafe Function GetVersion Lib "example64.dll" () As String
但是当我尝试称之为:
Debug.Print(GetVersion())
Excel崩溃。
我有其他几个函数工作正常返回数字等。 只是这个返回一个固定的string,给我适合。 我如何得到这个工作?
谢谢!