简体   繁体   English

从 C++ 代码生成的 Java 共享库

[英]Java shared library generated from C++ code

I'm trying to run C++ code in java using the java wrapper to generate such code, I've successfully generated all the code and implemented it in my code, but when I try to compile, I get an architecture error我正在尝试使用 java 包装器在 java 中运行 C++ 代码来生成这样的代码,我已经成功地生成了所有代码,但是当我尝试编译并在我的架构中实现它时,我得到了一个代码错误

Can't load this.dll (machine code=0x7) on a AMD 64-bit platform无法在 AMD 64 位平台上加载 this.dll(机器代码=0x7)

I'm running java 1.8.0_022, the PC I'm running the code in is a Intel 64 bit platform and I've tried to run the code in a 64 bit AMD computer and get the same error我正在运行 java 1.8.0_022,我运行代码的 PC 是 Intel 64 位平台,我尝试在 64 位 AMD 计算机上运行代码并得到相同的错误

any help to run C++ code in java?在 java 中运行 C++ 代码有什么帮助吗? Either to run it like this with a shared library or any other method使用共享库或任何其他方法像这样运行它

The typical solution to run C++ code in Java is with Java Native Interfaces (JNI)在 Java 中运行 C++ 代码的典型解决方案是使用 Java Native Interfaces (JNI)

https://docs.oracle.com/javase/8/docs/technotes/guides/jni/ https://docs.oracle.com/javase/8/docs/technotes/guides/jni/

You might also want to check SWIG that makes the C++/JNI integration much easier.您可能还想检查 SWIG,它使 C++/JNI 集成更加容易。

https://www.swig.org/Doc1.3/Java.html https://www.swig.org/Doc1.3/Java.html

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

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