Question

After reading a few articles, most of them show how to export C code in Android under JNI. My problem is that I have C++ classes with lots of overloaded functions. If I want to export/wrap them using JNI - Is it possible to do so if I can skip "extern" C which, If I am correct, is used to avoid name mangling of functions.

Was it helpful?

Solution

Removal of name mangling is required any time C code needs to be able to call into C++ code by symbol. If you're unsure if it's safe to turn that off, you can easily find out: assuming you're starting with code that compiles, remove the extern "C" around parts you're interested in. If it still compiles, you're safe... if you're not safe you'll receive undefined reference errors from the linker.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top