jni not support types as void*, unsigned int*, … What to do?

前端 未结 4 517
失恋的感觉
失恋的感觉 2021-01-13 22:46

I have .so (shared library) written in C++, lets call it functionality.so in which I implement different functions, here is list of some fu

4条回答
  •  攒了一身酷
    2021-01-13 23:01

    Have you considered using an automatic wrapper generator for this? I have used SWIG a few times now with much success. The reason that I mention it is that it has well developed patterns for dealing with things such as pointers, including void* and so on.

    Wrapper generation can be as easy as passing in the library's header file if the methods you want to wrap are as simple as the ones you list above. Even if you have some methods that are more complex (passing in structs, returning pointers to memory, etc) SWIG allows you to add code to the generated wrappers if needs be.

    Another plus point is that SWIG can wrap into a range of languages, not just Java.

提交回复
热议问题