Is it possible to use C++ static library for Unity WebGL?
First, I generate the llvm bitcode by using “clang -emit-llvm -o libhello_webgl.bc -c hello_webgl.cpp”
Second, I drop this libhello_webgl.bc in the floder “Assets”–“Plugins”–“WebGL”
Third, I create the C# script to import this function like this:
[DllImport(“__Internal”)]
private static extern int sum_dll_webgl(int x, int y);
Unfortunately, the error message is “libhello_webgl.bc is not valid according to llvm-nm, can not link”
If I use the C++ source code instead of this static library, it works.
Thank you for your suggestion.