So I would want to create a folder named "LibDLL" (for exemple) and put inside all my DLLs files.
I need a solution to say to the application : All DLLs you need are in the folder : ProgramDirectory + '\LibDLL\'
1. Use custom manifest for application (to add dependentAssembly).
Remove check "Use manifest resource" from project options (Application).
Make file (example) addon.rc in some folder "Res" with content: 1 24 "App.manifest".
Create file Res\App.manifest like this:
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<assembly xmlns="urn:schemas-microsoft-com:asm.v1" manifestVersion="1.0" xmlns:asmv3="urn:schemas-microsoft-com:asm.v3">
<assemblyIdentity name="Test" processorArchitecture="*" version="1.0.0.0" type="win32" />
<asmv3:trustInfo>
<asmv3:security>
<asmv3:requestedPrivileges>
<asmv3:requestedExecutionLevel level="asInvoker" uiAccess="false" />
</asmv3:requestedPrivileges>
</asmv3:security>
</asmv3:trustInfo>
<compatibility xmlns="urn:schemas-microsoft-com:compatibility.v1">
<application>
<!-- Windows 10 and Windows Server 2016 -->
<supportedOS Id="{8e0f7a12-bfb3-4fe8-b9a5-48fd50a15a9a}" />
<!-- Windows 8.1 and Windows Server 2012 R2 -->
<supportedOS Id="{1f676c76-80e1-4239-95bb-83d0f6d0da78}" />
<!-- Windows 8 and Windows Server 2012 -->
<supportedOS Id="{4a2f28e3-53b9-4441-ba9c-d69d4a4a6e38}" />
<!-- Windows 7 and Windows Server 2008 R2 -->
<supportedOS Id="{35138b9a-5d96-4fbd-8e2d-a2440225f93a}" />
<!-- Windows Vista and Windows Server 2008 -->
<supportedOS Id="{e2011457-1546-43c5-a5fe-008deee3d3f0}" />
</application>
</compatibility>
<dependency>
<dependentAssembly>
<assemblyIdentity type="win32" name="LibDLL" version="1.0.0.0" />
</dependentAssembly>
</dependency>
</assembly>
Compile it with resource compiler (winres) to addon.res.
Include into you app by {$R 'Res\AddOn.res'}.
2. In LibDLL subfolder create LibDLL.manifest like this:
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<assembly xmlns="urn:schemas-microsoft-com:asm.v1" manifestVersion="1.0">
<assemblyIdentity type="win32" name="LibDLL" version="1.0.0.0" />
<file name="SomeDll.dll" />
</assembly>
Repeat file tag for each dll in you subfolder.
3. Create file Project.exe.config file in exe folder:
<configuration>
<runtime>
<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
<probing privatePath="LibDLL" />
</assemblyBinding>
</runtime>
</configuration>
Run you app
Not work on XP