This utility provides a Windows-compatible, cross-architecture (x86-64 and arm64) capable way to build an intermediate shared library (DLL) that exposes every exported symbol of a desired library for transparent pass-through access, and allows loading other libraries at run-time. This newly produced library seamlessly delegates all calls to the functions exposed by the target library while being able to import an arbitrary number of other, user-specified libraries read from a settings file. Depending on the end-use requirement, x86-64, or arm64 assembly code is generated for
Games modification, extending functionality of (relatively) stable programs, etc.
- Windows
- A C++ development environment, e.g., Microsoft Visual Studio 2019 or later
- CMake
- At least one of the following:
N.B., without clang-cl, the cross-compiling preset will not work. MASM and ARMASM are not supported
- Clone the repo
cd /path/to/obcdcmake -S . -B build -DDLL_NAME="/path/to/dll/to/be/procurated.dll"- For clang, instead use:
cmake -S . -B build -T ClangCL ... - If using Ninja instead:
cmake -G Ninja -S . -B build -DCMAKE_C_COMPILER=clang-cl -DCMAKE_CXX_COMPILER=clang-cl ...
- For clang, instead use:
cmake --build build- Find in the target output directory (here:
/path/to/obcd/build) an identically-named dll (here:procurated.dll) to the one provided viaDLL_NAME. - Place this in the root directory (i.e. the same directory as the
.exe) of the program you wish to load it. - Create a file in that same directory called
dlls.txtwith a newline-separated list of the path(s) to whichever dll(s) you wish the dll just moved to load.
As above, but replace configure step with: cmake --preset=x64-arm64-cross-compile ...
- As above, but replace configure step with:
cmake --preset=x64-ninja-clangcl ...Now, there should be a file located at/path/to/build/output/bootstrapper/dllloader.exethat, when run, will loaddwmapi.dll, but since our dll is also calleddwmpai.dlland is located in the root directory of the.exeit will load that instead of the one (typically) inC:\Windows\system32\. Thedlls.txtfile will have the path to another dll produced for this test calledpiggy.dll, which will print its message at load and unload. Meanwhile,dllloader.execallsDwmFlushandDllCanUnloadNowwhich are seamlessly passed-through ourdwmapi.dllto the "real"dwmapi.dll.