We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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
运行
emcc -s WASM=1 -O3 -o program.js program.cpp --js-library library.js
返回
warning: unresolved symbol: _Z6funcNamev
program.js
#include <emscripten/emscripten.h> #include <stack> // 定义数组大小 #define N 100 // 防止 C++ 函数名被 Mangling #ifdef _cplusplus extern "C" { #endif // 预置函数,暴露给 JS 进行处理 extern void checku (); void EMSCRIPTEN_KEEPALIVE abc () { char a[] = "username"; checku(); } #ifdef _cplusplus } #endif
library.js
mergeInto(LibraryManager.library, { checku: function() { console.log(123) } });
笔误,踩了一个大坑。
#ifdef _cplusplus extern "C" { #endif
其实是 __cplusplus 前面两个下划线
__cplusplus
#ifdef __cplusplus extern "C" { #endif
添加这个判断防止 C++ 函数名被 Mangling.
The text was updated successfully, but these errors were encountered:
No branches or pull requests
运行
返回
program.js
library.js
笔误,踩了一个大坑。
其实是
__cplusplus
前面两个下划线添加这个判断防止 C++ 函数名被 Mangling.
The text was updated successfully, but these errors were encountered: