[LLVMdev] How to link code into EXE, or, am I doing this wrong?
John Slagel
john.slagel at gmail.com
Wed Nov 7 08:28:38 PST 2012
Hi,
I've been writing a 80's era-flavor of QuickBASIC compiler based on LLVM,
and it's come surprisingly far very quickly, LLVM is working great.
GOSUB's, GOTO's, FIELD statements.
I'm using Visual Studio 2010.
Here's my setup: I use LLVM to turn my AST into code, which, during
debugging I then execute natively using "getPointerToFunction" and the
runtime library it uses is a .lib in my VS2010 project that it calls into.
Then, to produce an EXE, I use addPassesToEmitFile to produce an .OBJ file
for the native machine (x86 windows), which I then link with my runtime
library using the Visual Studio linker:
link.exe test.bas.obj debug\BPRuntime.lib kernel32.lib /subsystem:console
Which produces a native executable that executes just fine under Windows.
All of that works great.
What I can't figure out, even after LOTS of searching, is how to replace
that with a LLVM linker or some other linker so that I can give out my
compiler and people could use it to make EXE files. I found similar posts
and questions but no good answers, and it seems that some of this (an LLVM
linker) is in flux.
Or, am I going about this wrong? Should I be generating bitcode and
making my runtime lib be bitcode and then link them using LLVM tools?
Thanks!
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20121107/36a8e3fa/attachment.html>
More information about the llvm-dev
mailing list