简体   繁体   English

使用C ++创建的VM从Java调用C ++函数

[英]Call C++ functions from Java with VM created by C++

I have an native C++ application that creates a JVM (JNI_CreateJavaVM()), which executes a method in a specified class. 我有一个本机C ++应用程序,该应用程序创建JVM(JNI_CreateJavaVM()),该JVM执行指定类中的方法。 I now want to call C++ functions from java using JNI. 我现在想用JNI从java调用C ++函数。 Is it possible to avoid System.loadLibrary() or do I have to create an extra dll just for JNI calls? 是否可以避免System.loadLibrary()或仅为JNI调用创建额外的dll?

Your native C++ application is PE executable without JNI symbols exported. 您的本机C ++应用程序是PE可执行文件,没有导出JNI符号。 That means you can't mix your JNI method in your native executable, in order to call C++ functions from Java, you have to create another dll and load it with System.loadLibrary . 这意味着你不能在你的本机可执行文件中混合你的JNI方法,为了从Java调用C ++函数,你必须创建另一个dll并用System.loadLibrary加载它。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM