Improved external interoperability when compiling as a library (for JNI calls)