Skip Menu |

This queue is for tickets about the Inline-Struct CPAN distribution.

Report information
The Basics
Id: 100253
Status: resolved
Worked: 15 min
Priority: 0/
Queue: Inline-Struct

People
Owner: ETJ [...] cpan.org
Requestors: PLICEASE [...] cpan.org
Cc:
AdminCc:

Bug Information
Severity: (no value)
Broken in: 0.12
Fixed in: (no value)



Subject: SYNOPSIS code does not work for me
When I run the exact code in the SYNOPSIS section I get this: iscah% perl synopsis.pl Can't locate object method "new" via package "Inline::Struct::Foo" (perhaps you forgot to load "Inline::Struct::Foo"?) at synopsis.pl line 3. Was able to get the (I believe) intended behavior by passing in the C code to the use line, and by adding a "typedef struct Foo Foo": use Inline C => <<'...' => structs => ['Foo']; struct Foo { int num; char *str; }; typedef struct Foo Foo; void myfunc(Foo *f) { printf("myfunc: num=%i, str='%s'\n", f->num, f->str); } ... Without the typedef the error is: ... ... ... synopsis_pl_28e5.xs:105:13: error: must use 'struct' tag to refer to type 'Foo' void myfunc(Foo *f) { ^ struct 1 error generated. make: *** [synopsis_pl_28e5.o] Error 1 ... ... ... Changing the myfunc signature to "void myfunc(struct Foo *f)" allowed it to compile correctly, but hid the myfunc(): iscah% perl synopsis.pl Undefined subroutine &main::myfunc called at synopsis.pl line 16. Also, the README that ships with this dist appears to be old, and provides an example that also does not work.
Fixed in just-released 0.13 (with tests). Thanks for report!
On Mon Nov 10 19:31:37 2014, ETJ wrote: Show quoted text
> Fixed in just-released 0.13 (with tests). Thanks for report!
Looks good, though you may also want to update the README.
Thanks! Updated README first.
On Mon Nov 10 20:23:44 2014, ETJ wrote: Show quoted text
> Thanks! Updated README first.
Ah you are right I diff'd the wrong thing :)