c******n 发帖数: 4965 | 1 got an exception, can't figure out why it happened:
thanks a lot
INFO 17:48:12,321 Unable to link C library. Native methods will be disabled.
java.lang.UnsatisfiedLinkError: Error looking up function
'$$YJP$$mlockall': java: undefined symbol: $$YJP$$mlockall
at com.sun.jna.Function.(Function.java:179)
at com.sun.jna.NativeLibrary.getFunction(NativeLibrary.java:344)
at com.sun.jna.NativeLibrary.getFunction(NativeLibrary.java:324)
at com.sun.jna.Native.register(N... 阅读全帖 |
|
N******K 发帖数: 10202 | 2 在开发交互式算法 更不能用java和c++混合 而应该用单一语言 那就是c++ 这样设置
断点差错也方便
比如用 jna或者jni 调用c++库 出现的问题:
JNA does not support mapping of c++ classes, so if you're using c++ library
you will need a jni wrapper
If you need a lot of memory copying. For example, you call one method which
returns you a large byte buffer, you change something in it, then you need
to call another method which uses this byte buffer. This would require you
to copy this buffer from c to java, then copy it back from java to c. In
this case jni w... 阅读全帖 |
|
r******g 发帖数: 691 | 3 南联盟人民军(JNA)军歌
南斯拉夫联盟国歌
和铁托元帅在一起
五一劳动节歌 |
|
|
|
|
N***m 发帖数: 4460 | 7 正在学习JNA library,测试了一下
计算sum_i sin(i)的值,i=0,2000000。
分别调用c library和java自己的数学库。
结果如下:
using c function
result = 0.5520835778318177 | elapsed time = 5.188 seconds
using java function
result = 0.5520835778317068 | elapsed time = 0.718 seconds
为什么会差这么多?那大家要是平时需要快速计算结果的情况下,如何
把c++程序和java结合?
===========================================================
public class A {
public interface CLibrary extends Library {
CLibrary INSTANCE = (CLibrary)
... 阅读全帖 |
|
|
|
d****i 发帖数: 4809 | 10 This is not a problem for Node at all. JavaScript is already super fast now
thanks to V8. For applications where you really need bare-metal performance,
you can use node-fft to call native libraries written in C/C++ easily,
pretty much like what JNI and JNA does for Java.
https://www.npmjs.com/package/node-ffi
actually |
|
d****i 发帖数: 4809 | 11 Then you should leave it as a C++ lib and give the so file to the Java folks
to call it via JNI or JNA. Pretty easy and straightforward. |
|
d****i 发帖数: 4809 | 12 If you don't want to have any overhead of IPC, then JNI is the best bet, or
if you don't want to write JNI wrapper function, then JNA (Java-Native-
Access) is an alternative way. Of course, there is SWIG to connect C/C++
with any other high level languages including Java:
http://www.swig.org/index.php
You may use that too. Also there are some ongoing effort by RedHat people to
make the C++<->Java bridge easier, called "Project Panama", but I haven't
tried that. |
|
|