JIT to MSVC?

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), 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.)

Thanks in advance

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

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).

I was under the impression that libstdc++ fell under GCC’s runtime library exception, which pretty much means you can use it in any way you see fit (including statically linked)

Ruben

Okay; I don't know the details off the top of my head.

-Eli