JNI for C using Swig & trouble with function pointer callback
问题 we have a C function in one of the libraries which are loaded in java, which accepts a function pointer function defination as below typedef char int8 typedef unsigned short uint16 uint32 poll_broadcasts(void *(pfn)(int8*,uint16)); In C it is used as below void handle_broadcasts( int8 *broadcast, uint16 length ) uint32 a = poll_broadcasts( (void*(*)(int8*,uint16)) handle_broadcasts ) But when you use Swig to generate JNI wrapper it creates following definition for poll_broadcast public static