[LLVMdev] Building LLVM as a shared library using Visual C++ 2010?

Michael Spencer bigcheesegs at gmail.com
Sat Apr 7 17:26:57 PDT 2012


On Fri, Apr 6, 2012 at 6:15 PM, Alan Garny <agarny at hellix.com> wrote:
> Hi,
>
> From what I have seen on this mailing list and elsewhere, it would seem that
> it isn’t possible to build LLVM as a shared library using Visual C++. Still,
> I would imagine that quite a few people are or would be interested in it,
> so… is there any plan to support this any time soon? This, unless it’s
> already supported in some way or another which I am not aware of…? I have
> been able to build LLVM as a shared library using Autotools and GCC (through
> MinGW) on Windows (as well as on Linux and Mac OS X), so it would really be
> a shame if the same couldn’t be done using Visual C++…
>
> Cheers, Alan.

The problem is that MSVC++ requires sprinkling
__declspec(dllexport/dllimport) all over the code, and we really don't
want to deal with maintaining that, as most developers have little to
no experience with Windows DLLs.

There may be a work around for this, which I partially implemented in
the past. You have a script which automatically generates a .def file
for all the public functions in all the object files. My attempt did
not work because I tried to export by ordinal, but that only supports
up to 2^16 symbols. It may work without exporting by ordinal, but I
never tried it.

- Michael Spencer




More information about the llvm-dev mailing list