I wrote a D module injector! It’s coded in C++, but it works with the latest DMD2.
Basically, here’s a rundown of the problem I was facing. You can’t use CreateRemoteThread to invoke LoadLibrary to load a D module into a foreign (or local, for that matter, seriously try LoadLibrary with CreateThread in a C++ application) process without it crashing. For some reason or another you must load the module in the primary process thread. This is what this hook does. I suspend the “main” thread, switch out EIP for my own (allocated code cave) and JMP back to the original code.
This has only been tested with “Hitman: Absolution” but give it a shot on your process and let me know how it goes! I included the source code and binary for the C++ program in the download below. Enjoy.