如何将 DLL 函数添加到 Inno Setup iss 文件中?

How to add DLL function into Inno Setup iss file?

我试图阅读有关如何在 Inno Setup 中加载 DLL 的示例代码,但我很困惑。

我有一个DLL(ChkArchInfo.dll),内容很简单:

extern "C" __declspec(dllexport) bool __stdcall IsARM()
{
    SYSTEM_INFO si; 
    GetNativeSystemInfo(&si); 

    if(PROCESSOR_ARCHITECTURE_ARM == si.wProcessorArchitecture)
       return true;

    return false;
}

我知道我需要使用 [Files] 部分来加载 DLL 文件。 但是如何在.iss声明这个函数让我使用呢?

顺便说一句,Inno Setup 中是否有获取 ARM 架构的函数? (ProcessorArchitecture 不包括 ARM 架构)

请帮我做.... 谢谢!!!

BR, 艾伦

阅读 Using DLLs and .NET assemblies 上的 Inno Setup 文档。

您主要必须声明一个 external 函数原型。并将 DLL 添加到 [Files] 部分,如果您想将 DLL 嵌入到安装程序中。

[Files]
Source: "MyDll.dll"; Flags: dontcopy
[Code]
function IsARM: Boolean;
  external 'IsARM@files:MyDll.dll stdcall';

尽管直接从 Pascal 脚本调用 GetNativeSystemInfo 会更好。但这是一个不同的问题。