[gdal-dev] A Java SWIG question

Barry DeZonia bdezonia at gmail.com
Wed Jun 21 10:34:56 PDT 2023


Thanks Even. I will try to throw that together later. But I think my
question is much more simple. I will show a small blurb below from
swig/include/java/typemaps_java.i

Code I have now follows right here. This code might conflict with current
code because I am wanting GUInt64s to go to longs and not BigIntegers
throughout the Java api. Note the code I am at a loss as to how to write
would be " Typemaps for GUInt64 * ". In other words a C array of GUInt64's
which I'd like to translate back and forth to long[]'s. Any example code
would be appreciated.

/***************************************************
 * Typemaps for GUInt64
 ***************************************************/

%typemap(in) (GUInt64) "$1 = $input;"
%typemap(out) (GUInt64) {
    /* %typemap(out) (GUInt64) */
    $result = result;
}
%typemap(jni) (GUInt64) "jlong"
%typemap(jtype) (GUInt64) "long"
%typemap(jstype) (GUInt64) "long"
%typemap(javain) (GUInt64) "$javainput"
%typemap(javaout) (GUInt64) {
    return $jnicall;
}

I tried a similar template for GUInt64* and made "jlong" into "jlongArray"
and "long" into "long[]" in those three places above but I have no idea how
to write the (javain) and (javaout) cases.

On Wed, Jun 21, 2023 at 3:35 AM Even Rouault <even.rouault at spatialys.com>
wrote:

> Barry,
>
> it could help if you could point to a public branch in your github fork
> with your pending work
>
> Even
>
> Le 21/06/2023 à 07:58, Barry DeZonia a écrit :
> > Hello,
> >
> > I am trying to work on the swig java api. I've made a lot of progress
> > and am running into one last error before my code completely compiles.
> > I am getting a swig complaint when passing a java long[] to a C/C++
> > call that is expecting GUInt64*.
> >
> > Basically the error message is "long[] cannot be converted to
> > SWIGTYPE_p_GUInt64". I've been reading and googling and I can't figure
> > out how to modify typemaps_java.i to accomplish this. I think it is a
> > simple thing but I am at a loss. Does anyone have any tips?
> >
> > _______________________________________________
> > gdal-dev mailing list
> > gdal-dev at lists.osgeo.org
> > https://lists.osgeo.org/mailman/listinfo/gdal-dev
>
> --
> http://www.spatialys.com
> My software is free, but my time generally not.
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/gdal-dev/attachments/20230621/287eb56f/attachment.htm>


More information about the gdal-dev mailing list