[llvm-dev] Add a mapping to a C++ lambda

Ramkumar Ramachandra via llvm-dev llvm-dev at lists.llvm.org
Tue Oct 27 11:46:15 PDT 2015


Courtney Robinson via llvm-dev <llvm-dev at lists.llvm.org> wrote:
> How do I get LLVM to call to a lambda?

Depends on how that lambda is implemented -- I don't know how C++11
lambdas are implemented offhand. As a rule of thumb, if you want to
call a function from your LLVM program, you need to mark it `extern
"C"` -- this makes sure that the symbol in loaded ELF is literally
what you typed out (C-linkage, no C++ name mangling). In Kaleidoscope,
they are calling the C sin and cos functions.

If you have lingering doubts, load up the executable image in lldb and
(lldb) im loo -s lambda

to determine if that symbol is defined or not.


More information about the llvm-dev mailing list