开发者

Accessing C++ native DLL (with namespaces) through JAVA

开发者 https://www.devze.com 2023-02-15 17:40 出处:网络
I have a c++ DLL where the functions are nested within namespaces. I need to access these functions in java.. i\'m not much of a java expert but i do know a little of its basics.

I have a c++ DLL where the functions are nested within namespaces.

I need to access these functions in java.. i'm not much of a java expert but i do know a little of its basics.

I found basic java codes to acce开发者_开发技巧ss methods in C++ native DLL using JNI but im not sure how to access the functions nested within namespaces.


You will probably need to get the mangled names of the C++ functions. You can use nm to do that on Unix or dumpbin /exports on Windows. The mangled name will have the namespace and function name, so it should be easy to find (unless there are several overloads with the same name that you need to distinguish). Are you sure the functions are normal C++ functions and not class methods?


Do yourself a favour : use BridJ for C++ interop, it should be able to deal with most namespace issues :-)

(disclaimer : I'm BridJ's author)


"Jeremiah Willcock" answer is right, in any case, you can always access a D.L.L. functions, inside classes or namespaces using "mangled names", its the weird, dirty way of doing things, but, its works, even if there are other ways.

You could do some tests, accesign those functions, and later, make your own wrapper.

0

精彩评论

暂无评论...
验证码 换一张
取 消