[LLVMdev] Shared library support of llvm

Óscar Fuentes ofv at wanadoo.es
Wed May 8 10:19:52 PDT 2013

Peng Cheng <gm4cheng at gmail.com> writes:

> According to http://llvm.org/docs/CMake.html, "Shared libraries are not
> supported on Windows and not recommended in the other OSes".
> The problem is that static libraries have some limitations, especially when
> linked into multiple shared libraries, the global data of llvm could have
> multiple copies leading to undefined behaviors.  This has caused much pains
> during my usage of llvm.
> My questions are:
> 1. What are the reasons to not support shared libraries on Windows and not
> recommended in other OSes?

IIRC shared libraries are not recommended on other OSes because people
found that starting an executable that uses all those LLVM libraries is
slow, which hurts a lot when running the test suite, so the developers
tend to avoid shared libraries and they are not tested nor their
specific requirements considered while developing LLVM. IIRC (again)
long time ago I did some experimentation and running tests was about as
fast whith using shared libraries as with static ones on a Linux

Windows with the MSVC++ compiler does not support shared libraries at
all for the reasons given by Reid. For MinGW it is possible to create a
monolithic DLL (I did just that long time ago) or maybe DLL versions of
the static libraries. However, the caveats about being an untested
configuration are even stronger than on the other OSes.

> 2. Are there any plans to support shared libraries?


More information about the llvm-dev mailing list