我在 DLL 中有两个 C 函数,它们在定义文件中定义,并导出以在 Inno Setup 中使用。
char* __stdcall GetName()
{
return "Kishore";
}
void __stdcall getName(char* strName)
{
strcpy(strName, "Kishore");
}
Run Code Online (Sandbox Code Playgroud)
Inno Setup 代码将加载自定义 DLL 并调用函数/过程来返回名称
{ Inno Setup script }
[Code]
procedure getName(MacAddress: String);
external 'getName@files:MyDll.dll stdcall setuponly';
function GetName():PAnsiChar;
external 'GetName@files:MyDll.dll stdcall setuponly';
function NextButtonClick(CurPage: Integer): Boolean;
var
StrName: String;
begin
SetLength(StrName,15);
getName(StrName); { displaying only single character }
StrName := GetName(); { this call is crashing }
end
Run Code Online (Sandbox Code Playgroud)
如何在 Inno Setup 脚本中检索名称而不崩溃?