[cfe-dev] Get mangled names C++
fk.fuchs at googlemail.com
Fri Jul 16 07:54:37 PDT 2010
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::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).
Am 16.07.2010 um 15:55 schrieb Anton Korobeynikov:
>> 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.
> With best regards, Anton Korobeynikov
> Faculty of Mathematics and Mechanics, Saint Petersburg State University
More information about the cfe-dev