FFI/Alien: Structures with arrrayed fields

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

FFI/Alien: Structures with arrrayed fields

Schwab,Wilhelm K
Hello all,

I am faced with something like the following:

struct complex { double real; imaginary; };
struct ugly {
        int gratuitousSize;
        long importantStuff[64];
        complex * moreImportantStuff[64];
};

The question is how to explain this to FFI?  The closest things I have found always seem to be byte arrays, so the "third element" in the arrays of #fields is not well-revealed.  Does anyone know whether it is additive or multiplicative, and/or how to use it to make sense of the above struct?

Bill


_______________________________________________
Pharo-project mailing list
[hidden email]
http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-project
Reply | Threaded
Open this post in threaded view
|

Re: FFI/Alien: Structures with arrrayed fields

Schwab,Wilhelm K
Bert,

Re your suggestion about making an external structure for "complex," please consider that done.  The question is how to then handle the array (of pointers), and even the array of longs.

Bill





-----Original Message-----
From: [hidden email] [mailto:[hidden email]] On Behalf Of Schwab,Wilhelm K
Sent: Monday, March 15, 2010 8:29 AM
To: [hidden email]; [hidden email]
Subject: [Pharo-project] FFI/Alien: Structures with arrrayed fields

Hello all,

I am faced with something like the following:

struct complex { double real; imaginary; }; struct ugly {
        int gratuitousSize;
        long importantStuff[64];
        complex * moreImportantStuff[64];
};

The question is how to explain this to FFI?  The closest things I have found always seem to be byte arrays, so the "third element" in the arrays of #fields is not well-revealed.  Does anyone know whether it is additive or multiplicative, and/or how to use it to make sense of the above struct?

Bill


_______________________________________________
Pharo-project mailing list
[hidden email]
http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-project

_______________________________________________
Pharo-project mailing list
[hidden email]
http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-project
Reply | Threaded
Open this post in threaded view
|

Re: FFI/Alien: Structures with arrrayed fields

Schwab,Wilhelm K
Bert,

So the "third element" is the field's (array's) size in bytes, right?

Thanks!!!!

Bill


_______________________________________________
Pharo-project mailing list
[hidden email]
http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-project