How can "const unsigned char *" be wrapped by swig for java

How can I link the following C-function to SWIG?

int add_option(const unsigned char *data);

I am currently completing this:

public static int add_option(SWIGTYPE_p_unsigned_char data);

Is it possible to wrap it for String, Byte [], or something similar?

+5
source share
2 answers
     %module Example

     %{
       int func(const unsigned char *data);
      %}


      %include <arrays_java.i>

      %apply signed char[] { const unsigned char *data};


      int func(const unsigned char *data);

Use this code !!!!!

+2
source

Yes it is possible. In the worst case, you can create your own map. But there should be enough%. Try the following:

    %apply signed char *INOUT { unsigned char *pSeqData };

[I adapted this from a similar problem in my * .i file, after months of using Swig. YMMV.]

% apply . , SWIG.

+1

All Articles