[cfe-dev] JIT to MSVC?

Eli Friedman eli.friedman at gmail.com
Mon Aug 22 17:20:07 PDT 2011


On Mon, Aug 22, 2011 at 4:57 PM, Graham Wakefield
<wakefield at mat.ucsb.edu> wrote:
> Hi list,
>
> I'm having an issue JIT compiling some C++ in an application I'm working on. JIT is failing with an llvm linker error on symbol _Znwj (the C++ new operator) on Windows, but works fine on OSX. As far as we can tell, this may be because the JIT is mangling new for the g++ standard library, but the host application is built using Visual Studio 2008 (aka VC9) which has a different mangled name for new.
>
> I was wondering if there are any configuration options we can use for Clang/LLVM to target MSVC runtime (for JITted code),

There is an option to use MSVC-compatible mangling, but it's
experimental, and you're likely to run into other C++ ABI issues.  I
wouldn't suggest doing this.

> or if anyone has any suggestions for strategies for embedding libg++ (the application will need to work on non-developer systems, so we can't rely on the presence of libraries on the system.)

You should be able to link against libstdc++.dll, distribute it with
your app, and have everything just work (although note that libstdc++
is LGPL).

Note that if you have RTTI and exceptions turned off, and are not
using standard library headers, you don't really need much besides
operator new/delete; it would be trivial to write your own
implementation.

-Eli




More information about the cfe-dev mailing list