Looking for any complex examples using Inline::Struct. I've tried
examples in the POD, e.g.
(WinXP, AS 5.6, Inline::Struct 0.06):

use Inline C => Config => Structs => ['Foo'];

my $obj = Inline::Struct::Foo->new;
$obj->num(10);
$obj->str("Hello");

myfunc($obj);

__END__
__C__
  
struct Foo {
int num;
char *str;
};

void myfunc(Foo *f) {
printf("myfunc: num=%i, str='%s'\n", f->num, f->str);
}


produces the following

C:\Perl>perl inlinetst2.pl
Can't locate object method "new" via package "Inline::Struct::Foo" (perhaps you
forgot to load "Inline::Struct::Foo"?) at inlinetst2.pl line 3.


...and while the following (trivial) example works:

use Inline C => <<'END', ENABLE => 'STRUCTS';
struct Fraction {
long numer;
long denom; 
};
END

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

... a minor addition to it generates lots of errors:

use Inline C => <<'END', ENABLE => 'STRUCTS';
struct Fraction {
long numer;
long denom; 
};

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";

...results in 

C:\Perl>perl inlinetst3.pl

Microsoft (R) Program Maintenance Utility   Version 6.00.8168.0
Copyright (C) Microsoft Corp 1988-1998. All rights reserved.

        C:\Perl\bin\perl.exe -IC:\Perl\lib -IC:\Perl\lib C:\Perl\lib\ExtUtils/xs
ubpp  -typemap C:\Perl\lib\ExtUtils\typemap -typemap C:\Perl\lib\ExtUtils\typema
p -typemap C:\Perl\_Inline\build\inlinetst3_pl_96b3\Struct.map inlinetst3_pl_96b
3.xs > inlinetst3_pl_96b3.xsc && C:\Perl\bin\perl.exe -IC:\Perl\lib -IC:\Perl\li
b -MExtUtils::Command -e mv inlinetst3_pl_96b3.xsc inlinetst3_pl_96b3.c
Error: 'struct Fraction *' not in typemap in inlinetst3_pl_96b3.xs, line 207
Error: 'struct Fraction *' not in typemap in inlinetst3_pl_96b3.xs, line 211
Error: 'struct Fraction *' not in typemap in inlinetst3_pl_96b3.xs, line 234
Error: 'struct Fraction *' not in typemap in inlinetst3_pl_96b3.xs, line 243
Error: 'struct Fraction *' not in typemap in inlinetst3_pl_96b3.xs, line 252
Error: 'struct Fraction *' not in typemap in inlinetst3_pl_96b3.xs, line 261
Error: 'struct Fraction *' not in typemap in inlinetst3_pl_96b3.xs, line 270
Error: 'struct Fraction *' not in typemap in inlinetst3_pl_96b3.xs, line 303
Error: 'struct AnotherStruct *' not in typemap in inlinetst3_pl_96b3.xs, line 356
Error: 'struct AnotherStruct *' not in typemap in inlinetst3_pl_96b3.xs, line 360
Error: 'struct AnotherStruct *' not in typemap in inlinetst3_pl_96b3.xs, line 383
Error: 'struct AnotherStruct *' not in typemap in inlinetst3_pl_96b3.xs, line 392
Error: 'struct AnotherStruct *' not in typemap in inlinetst3_pl_96b3.xs, line 401
Error: 'struct AnotherStruct *' not in typemap in inlinetst3_pl_96b3.xs, line 410
Error: 'struct AnotherStruct *' not in typemap in inlinetst3_pl_96b3.xs, line 419
Error: 'struct AnotherStruct *' not in typemap in inlinetst3_pl_96b3.xs, line 452


And nested structs, or even pointers to other structs, don't even seem possible
(esp. if you can't define more than 1 struct!).

Any pointers or examples much appreciated,
Dean Arnold
Presicient Corp.
www.presicient.com

Reply via email to