[LLVMdev] Output to a DLL
eli.friedman at gmail.com
Thu Jun 11 12:11:13 PDT 2009
On Thu, Jun 11, 2009 at 7:34 AM, Nicolas Capens<nicolas at capens.net> wrote:
> I’d like to be able to write JIT-compiled code to a Windows DLL. I have no
> idea where to start though. Does LLVM already offer some support for this?
You can't use the JIT to compile code for a DLL; it simply isn't
designed for that.
> Or would it be straightforward to write my own DLL writer (no advanced
> features needed)? Or maybe I could use an external linker? All help highly
You can write out an assembly (.s) file and use mingw as+ld to build a
DLL. Essentially, this is just building a DLL the same way a
conventional compiler like llvm-gcc would.
Directly emitting a DLL would be a lot of work, although it doesn't
require any architectural changes to LLVM; you'd need something like
http://wiki.llvm.org/Direct_Object_Code_Emission plus some code to
More information about the llvm-dev