且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

我们如何在Java代码中使用.cpp文件

更新时间:2023-11-09 16:12:46

我已经回答了这个问题 ^ ].为了将来参考,请仅在一个论坛中发布您的问题.
I already answered this question here[^]. For future reference, please post your question in one forum only.


您应该阅读有关 ^ ].
You should read about the Java Native Interface, JNI[^].



C ++和Java具有非常不同的基础概念,因此不可能直接实现.
您可以尝试将C ++代码翻译为Java,有时这几乎是不可能的.如果使用Google翻译,您会发现一些免费或付费的翻译程序.
我的个人经验是,它们几乎没有用.
对于手写翻译,请查看快速转换并参考最常见的内容
C/C ++和Java中使用的常见命令
[^ ] .

最终,最快,***的方法是使用C ++代码库作为参考从头开始用Java编写.
欢呼声,
AR
Hi,
C++ and Java have so different underlying concepts that it''s not possible directly.
You may try to translate the C++ code to Java, which is sometimes near to impossible. You will find some free or paid translator programs if googling for them.
My personal experience is that they are almost useless.
For handwritten translation have a look at Quick conversion and reference to the most
common commands used in C/C++ and Java
[^].

Eventually the quickest and best way is to write in Java from scratch, using the C++ code base as reference.
cheers,
AR