Making generic calls with JAVA JNI and C++

后端 未结 3 1609
借酒劲吻你
借酒劲吻你 2021-01-13 15:23

I am working with JNI and I have to pass in some generic types to the C++. I am stuck with how to approach this on the C++ side

HashMap

        
3条回答
  •  佛祖请我去吃肉
    2021-01-13 16:12

    It depends on what you're trying to map to and if they are yours to change.

    Here are a few directions I'd try to go about (if i were you, that is :) ):

    1. Using SWIG templates (related SO question) or TypeMaps.
    2. Doing some reflection magic to be used against your-own-custom-generic-data-passing native API (haven't figured the details out, but if you want to follow on it, tell what you've got on the C++ side).

    This has been asked before and you might want to resort to Luis' arrays solution.

提交回复
热议问题