Guillaume Bittoun
2017-04-21 09:52:36 UTC
Hi everyone,
I am having hard time understanding how I can pass java arrays to my C++
code using SWIG. The java code I would like to use is the following :
float[] foo = someProcessingFunction(âŠ)
myCppFunction(foo)
So that the prototype `myCppFunction` in my C++ code would be either,
myCppFunction(float * floatArray)
or,
myCppFunction(float * floatArray size_t length)
So far, all my attempts have failed, I thought there would be something
like the `char * STRING` and`char * BYTE` typemaps that can maps
`byte[]` to `String` or `char*` but I still cannot find anything about
mapping float arrays.
There is either something obvious I missed or maybe a typemap to create
but I cannot find any solution so far. Is there a way to map javaâs
`float[]` to C++ `float *` ? Moreover, is there a way to return a java
`float[]` using a C++ function wrapped by swig ?
Help is welcome.
Regards,
Guillaume
I am having hard time understanding how I can pass java arrays to my C++
code using SWIG. The java code I would like to use is the following :
float[] foo = someProcessingFunction(âŠ)
myCppFunction(foo)
So that the prototype `myCppFunction` in my C++ code would be either,
myCppFunction(float * floatArray)
or,
myCppFunction(float * floatArray size_t length)
So far, all my attempts have failed, I thought there would be something
like the `char * STRING` and`char * BYTE` typemaps that can maps
`byte[]` to `String` or `char*` but I still cannot find anything about
mapping float arrays.
There is either something obvious I missed or maybe a typemap to create
but I cannot find any solution so far. Is there a way to map javaâs
`float[]` to C++ `float *` ? Moreover, is there a way to return a java
`float[]` using a C++ function wrapped by swig ?
Help is welcome.
Regards,
Guillaume