#270 Fix wrapping of foo(char *outbuffer)

closed-fixed
nobody
general (37)
5
2014-08-25
2011-06-06
No

It would be nice to add support for char* in arrays_java.i

see attached patch

Discussion

  • William Fulton

    William Fulton - 2011-06-17

    As per swig-user mailing list discussion, use:

    %include "arrays_java.i"
    JAVA_ARRAYS_IMPL(char, jbyte, Byte, Char)
    JAVA_ARRAYS_TYPEMAPS(char, byte, jbyte, Char, "[B")
    %typecheck(SWIG_TYPECHECK_INT8_ARRAY) /* Java byte[] */
    signed char[ANY], signed char[]
    ""
    %typemap(memberin) charANY], char[];
    %typemap(globalin) charANY], char[];

    I've checked in some changes to arrays_java.i so that swig-2.0.5, you can just use:

    %include "arrays_java.i"
    JAVA_ARRAYS_IMPL(char, jbyte, Byte, Char)
    JAVA_ARRAYS_TYPEMAPS(char, byte, jbyte, Char, "[B")
    %typecheck(SWIG_TYPECHECK_INT8_ARRAY) /* Java byte[] */
    signed char[ANY], signed char[]
    ""
    or:

    %include "arrays_java.i"
    %apply signed char[ANY] { char[ANY] }
    %apply signed char[] { char[] }
    %typemap(memberin) charANY], char[];
    %typemap(globalin) charANY], char[];

     
  • William Fulton

    William Fulton - 2011-06-17
    • status: open --> closed-fixed
     

Log in to post a comment.