Get mangled names C++

There are several problems with what you are trying to do,

Firstly it will only work with gcc or something that uses exactly the
same ABI as clang so for now no MSVC

Ok but that is not a real concern … I’m avoiding MSVC anyway.

secondly the JIT is supposed to be able to use dlsym to resolve
functions at runtime but this only works on non windows,
Putting manglings into your code manually is horrible and will only
break stuff down the road.

Ugh this would indead be a showstopper. Does name mangling work differently on windows?
To state it agian I dodn’t want to mangle my methods manually!
I just tested it for one routine to see whether or not it works.

MSVC has a different mangling, gcc uses the same one as all x86-32
you cannot use MSVC C++ libs, you cannot get the JIT code to link
properly with the host app since windows doesnt do dlsym properly or
at all.

You really shouldnt be using C++ as a scripting lanugage!

Ugh this would indead be a showstopper. Does name mangling work differently
on windows?

No, name mangling is same across the platforms. The problem is that
all the linking is mostly static on windows and binaries (not
libraries) cannot "export" functions. So, on windows you will need to
add the name <-> address mapping by hands.

Ok good to know (about the name mangling on Windows & the rest).
Now concerning the static linkage. I'm using the DynamicLibrary stuff of llvm to declare the function to the clang-compiled module like this

  llvm::sys::DynamicLibrary::AddSymbol(symbolName, (void*)testCall);
  
        llvm::Type* r = (llvm::Type *)llvm::Type::getVoidTy(*context);
  llvm::FunctionType *ft = llvm::FunctionType::get(r, false);
  
  llvm::Module* module=new llvm::Module("global",*context);
  llvm::Function *f = llvm::Function::Create(ft, llvm::Function::ExternalLinkage,mangled_name, module);

it is inspired by this code http://github.com/speveril/eggengine/blob/master/src/script_LLVM.cpp (may be the author is around here as well).

-Frank

Now what is being talked about? I export functions from an executable
all the time, I have dynamically linked to them from both within the
same executable and from linked in DLL's as well. Can you give an
example of what you want done on Windows that cannot be done?