Many thanks, works wonderfully, and will hopefully make
my job much simpler!

Next question (I'm ever so demanding ;^): how to nest structures, and reference them ?
E.g., 

my $o = Inline::Struct::Fraction->new(4, 3);
print $o->numer, $o->denom, "\n";

my $a = Inline::Struct::AnotherStruct->new($o);

my $p = $a->x;

print $p, "\n";

use Inline C => Config => STRUCTS => 1;

use Inline C => <<'END';

typedef struct {
 long numer;
 long denom;
} Fraction;

typedef struct {
 Fraction *x;
} AnotherStruct;

END


Compiles OK, but $a->x returns undef, so I assume creating
a structure reference within another structure requires more heavy lifting ? 
I can create some Inline::C accessors/mutators to handle
the structure pointer, but is there anyway
to associate them with specific structures ? And shouldn't it be possible
to do that within Inline::Struct ?
I saw a note in the archives (circa 2001) wrt nested structures which claimed
that including the structure didn't work, but a pointer to a structure would...
Any ideas how this should work ?

TIA,
Dean Arnold
Presicient Corp.
www.presicient.com

Reply via email to