[LLVMdev] Build LLVM as a DLL on Windows x86

Alan Garny agarny at hellix.com
Sun Nov 13 02:31:20 PST 2011



I need to build a shared version of LLVM on Windows, Linux (both x86 and
x64) and Mac OS X. So far, I have been able to build LLVM on Linux and Mac
OS X, and it's all working fine as confirmed by a small LLVM test code that
I wrote.


However, on Windows, even though I get a DLL, that DLL doesn't contain any
(exported) functions (according to DLL Export Viewer; see


Now, I know that shared libraries are not supported on Windows using CMake
(according to http://www.llvm.org/docs/CMake.html) which would have been my
preferred building choice, but I didn't see anything against them not being
supported using Autotools, so I thought I would try it that way (as I
successively did on Linux and Mac OS X). So, based on the documentation at
http://www.llvm.org/docs/GettingStarted.html, I installed MinGW/MSYS
(http://sourceforge.net/projects/mingw/), selecting C++ Compiler, MSYS Basic
System and MinGW Developer ToolKit from the list of components to install.
Then, I installed Python (http://www.python.org/download/; version 2.7.2 not
3.x) even though it's not listed as a pre-requirement, but without it, it
doesn't work, so. Note that version 3.x of Python didn't work for me, I had
to use version 2.7.2. Otherwise, I obviously had to do something like export
PATH=/c/Python27:$PATH to make it accessible from a shell prompt. Otherwise,
I haven't installed binutils since I don't seem to need it.?


Anyway, from there, I got LLVM's source code (see
http://www.llvm.org/releases/), unpacked it and:

    cd <LLVM-ROOT>

    mkdir ../LLVM-build

    cd ../LLVM-build

    ../<LLVM-ROOT>/configure --disable-docs --enable-shared



As you can tell, I am not using gmake (I don't have it, but maybe it comes
with binutils?), but make. I imagine it shouldn't make any difference.?
Whatever the case, and as mentioned earlier, even though I do get a (~15MB
big) DLL, it doesn't contain any (exported) functions.


Otherwise, I tried the above building process with the trunk version of
LLVM, but to no avail. Maybe this will be possible with the forthcoming LLVM
3.0.? Anyway, any help on the above would be much appreciated.


Cheers, Alan.

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20111113/882d99aa/attachment.html>

More information about the llvm-dev mailing list