How can I make Swig correctly wrap a char* buffer that is modified in C as a Java Something-or-other?

后端 未结 3 1985
春和景丽
春和景丽 2020-12-30 10:11

I am trying to wrap some legacy code for use in Java and I was quite happy to see that Swig was able to handle the header file and it generate a great wrapper that almost wo

3条回答
  •  别那么骄傲
    2020-12-30 10:49

    Another simple and dumb workaround if you are as lazy as I am and if you have the liberty to change the prototype of C/C++ function slightly. Change the type of your parameter ( in your interface file) to unsigned char* instead of char* and then SWIG maps it to SWIGTYPE_p_unsigned_char :-) instead of String in Java

提交回复
热议问题