g++: How to unmangle exported symbols

前端 未结 1 974
一生所求
一生所求 2021-01-13 11:20

I\'m trying to compile a Java library that uses JNI. When I start the program, I see a crash with an UnsatisfiedLinkError, which says that a particular method could not be f

1条回答
  •  挽巷
    挽巷 (楼主)
    2021-01-13 12:13

    For JNI calls to work with Windows DLLs compiled with GCC you need to add a add-stdcall-alias parameter to GCC on linking phase:

    gcc -Wl,--add-stdcall-alias
    

    Which will add correct function names to the DLL and thus enable calls via JNI.

    0 讨论(0)
提交回复
热议问题