Dean Arnold wrote:
use Inline C => <<'END', ENABLE => 'STRUCTS'; struct Fraction { long numer; long denom; };
END use Inline C => <<'END', ENABLE => 'STRUCTS';
struct AnotherStruct { long x; long y; }; END
my $o = Inline::Struct::Fraction->new(4, 3); print $o->numer, $o->denom, "\n";
my $a = Inline::Struct::AnotherStruct->new(10, 20); print $a->x, $a->y, "\n";
Works for me ok on win2k with the amendments given above. Otherwise I get the same as you. (I'm using the win32 port of the gcc compiler, not msvc - which seems to be making absolutely no difference at all :-)
It wouldn't surprise me if there's already a way of including the 2 structs within the same Inline block - but I haven't yet found such a solution - haven't really looked all that hard ....
The module is not for production, which I guess means that we should expect the unexpected.
Hth.
Cheers, Rob
Had a bit of spare time tonight and took a closer look. A bodgy typemap is being written if there is more than one struct.
In 'Struct.pm', in the write_typemap() code, change:
$TYPEMAP .= join "\n", map { "$_\t\t$type" } @ctypes;
to
$TYPEMAP .= join "\n", map { "$_\t\t$type\n" } @ctypes;Should do the trick :-)
I'm cc'ing this to the author in case he doesn't already know about it.
Cheers, Rob
--
Any emails containing attachments will be deleted from my ISP's mail server before I even get to see them. If you wish to email me an attachment, please provide advance warning so that I can make the necessary arrangements.
