On 4 August 2014 16:45, Thomas Bany <mun.sysdev@gmail.com> wrote:
Hi again !


I'm having trouble to call the function with the following prototype :

void propagateTLE(orbit_t orb, double secondSince[], xyz_t * out, size_t nbEpoch)

with the corresponding NB call:

self nbCall: #( void propagateTLE(orbit_t orbit, double * secondSince, xyz_t * out, size_t nbEpoch) )

The argument secondSince is an input and the argument out is the output pointer that the function should fill. I have made 2 subclass of NBExternalArray to feed this function, (allmost) namely: ArrayOfDoubles and ArrayOfXYZ. Should I mention that type��xyz_t is a struct that I modeled with an NBExternalStructure.

I face 2 issues:
  • The type��ArrayOfXYZ��is refused as an xyz_t* type. However, the��ArrayOfDoubles is accepted as a double* type.
  • If a get rid of the out argument to test the array secondSince, I get an undefined error��(Error durring FFI call: nil).


My current solution is to use the adress of my arrays and the following NB call:

self nbCall: #( void propagateTLE(orbit_t orbit, NBExternalAddress secondSince, NBExternalAddress out, size_t nbEpoch) )

if you explicitly specify NBExternalAddress, then it won't accept any other argument than instance of NBExternalAddress.

Also, note there's no marshallers for (sub)instances of NBExternalArray,
and thus you cannot pass them directly, but only by passing pointer to its elements using #address method.

I.e, if you using 'whatever *', you can pass a pointer to array by:
myArray address.

��
But it feels like I'm cheating my way trough, by pretty much avoiding any type check. Any clue as to why the typecheck of NB is refusing to call my function ?


Thanks in advance,

Thomas.




--
Best regards,
Igor Stasenko.