Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

extern "C" declarations not being generated #67

Open
dangquan-quoine opened this issue Oct 25, 2019 · 4 comments
Open

extern "C" declarations not being generated #67

dangquan-quoine opened this issue Oct 25, 2019 · 4 comments

Comments

@dangquan-quoine
Copy link

i compiled this file demo.cpp :
extern "C" {
int do_something(){
return 0;
}
}
the tool is not generate do_something function. please help me.

@rpav
Copy link
Owner

rpav commented Oct 25, 2019

Looks like extern "C" declarations are broken (now? before? not sure). The C++ aspects of this haven't been tested overly much.

@rpav rpav changed the title function name in c++ code with extend C block. extern "C" declarations not being generated Oct 25, 2019
@dangquan-quoine
Copy link
Author

dangquan-quoine commented Oct 26, 2019

I use clang to compile c++ to web assembly, if i want to export function, i must let that function to extern "C". this case is parse with LinkageSpecDecl in clang. @rpav

@spaceotter
Copy link
Contributor

If the WebAssembly interface can only use functions with C linkage, it sounds more like you need to use something like this project I'm working on: https://github.com/spaceotter/unplusplus - this generates C linkage stubs from a C++ library automatically. The header it generates can be processed as a C header without extern "C".

@rpav
Copy link
Owner

rpav commented Jun 4, 2021

@spaceotter unplusplus looks like the holy grail for wrapping C++! Will definitely keep my eye on it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants