JNA does not support C++11?

JNA does not support C++11?

本文关键字:C++11 support not does JNA      更新时间:2023-10-16

在Java上调用c_func()时,以下代码将终止。如果不使用元组,则不会发生这种情况。我猜JNA不支持C++11,因为它引入了元组类型。我的猜测正确吗?

C++代码

#include <tuple>
#include <map>
int c_func(){
    static std::map< std::tuple<float, float, float>, float> mapOfTuple;
    return 1;
}

Java代码

...
public interface CLibrary extends Library {
    public static final String JNA_LIBRARY_NAME = "test";
...
}
public static void main(String[] args) {
    c_func();
}

JNA工作在接口级别,而不是实现级别。它甚至不知道您在c_func中使用了C++11。然而,您的C++函数可能依赖于C++11运行库,这可能是问题所在。