【发布时间】:2021-01-08 18:13:13
【问题描述】:
当使用 Clang 将具有 extern 函数声明的 C(++) 代码编译到 WebAssembly 时,它会给出 undefined reference 错误,而不是导入符号。什么选项会使链接器将这些作为导入添加到 WebAssembly 模块而不是尝试解析它们?
#ifdef __cplusplus
extern "C" {
#endif
extern void externalFunction(void);
#ifdef __cplusplus
}
#endif
int main() {
externalFunction();
return 0;
}
【问题讨论】:
标签: c++ c clang linker-errors webassembly