Search code examples
dll64-bitinno-setup32bit-64bitpascalscript

Is there a way to use 64-bit DLLs in the [Code] section in Inno Setup?


In the documentation 64-bit Installation Limitations the following is said:

You cannot load/use 64-bit DLLs in the [Code] section, because Windows does not allow 32-bit processes to load 64-bit DLLs (and vice versa). A 32-bit process can, however, launch 64-bit EXEs. Use the Exec function or the [Run] section to do that.

Here LoadDLL it is said that LoadDLL function is deprecated and there's a link to Using DLLs and .NET assemblies instead. But there's nothing about bitness or LoadDLL function in here. Why would I need to use the LoadDLL function anyway and is there a way to use 64-bit DLLs in my [Code] section?


Solution

  • Inno Setup is 32-bit, so it can load 32-bit DLLs only. The bitness of the system has no effect here. The documentation you quote is correct and absolutely clear:

    You cannot load/use 64-bit DLLs in the [Code] section, because Windows does not allow 32-bit processes to load 64-bit DLLs (and vice versa).


    That does not mean there's no solution for your specific problem, which you are trying to solve by loading the 64-bit DLL. But you have to ask about that specific problem.


    Note that Inno Setup can register 64-bit DLLs, as they are registered using an external process regsvr32, not by Inno Setup 32-bit process itself. There's 32-bit and 64-bit version of regsvr32. I believe you need to (and Inno Setup does that) to execute the right version of regsvr32 according to the bitness of your DLL.