FloydATC has asked for the wisdom of the Perl Monks concerning the following question:
// libtwintree.h: int return_one( void ); int return_zero( void );
Obviously these are just placeholders for the real functions that this library will implement, it's just that before I write tons of code I really need to get the h2xs monster to cooperate. Anyway, here's the Makefile I'm using to try and fit the pieces together:// libtwintree.c: #include "libtwintree.h" int return_one( void ) { return 1; } int return_zero( void ) { return 0; }
According to the h2xs manpage, the -x switch is supposed to "Automatically generate XSUBs basing on function declarations in the header file". So... why is it that the generated TwinTree.xs looks like this?TwinTree.pm : TwinTree.xs cd TwinTree && \ perl Makefile.PL && \ make && \ make test && \ make install TwinTree.xs : libtwintree.so install mkdir -p TwinTree && \ cp libtwintree.h TwinTree && \ h2xs -Oxan TwinTree -L/usr/local/lib -llibtwintree libtwintree +.h libtwintree.so : libtwintree.o gcc -shared -Wl,-soname,libtwintree.so -o libtwintree.so libtw +intree.o -lc libtwintree.o : gcc -fPIC -g -c -Wall libtwintree.c clean : rm -Rf *.o *.so TwinTree install : libtwintree.so cp libtwintree.so /usr/local/lib && \ ldconfig -n /usr/local/lib
No XSUBs, the entire module is basically 500K of absolutely nothing. What am I missing that's so obvious nobody seems to think it's worth mentioning in the manpage?#include "EXTERN.h" #include "perl.h" #include "XSUB.h" #include "ppport.h" #include "const-c.inc" MODULE = TwinTree PACKAGE = TwinTree INCLUDE: const-xs.inc
Not that I think it matters, but I'm running perl 5.8.8 and uname -a is Linux atlas.atc.no 2.6.27-briullov.1 #1 SMP Fri Apr 3 19:34:58 MSD 2009 i686 i686 i386 GNU/Linux.
Edit: pasted the proper contents of twintree.c
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Why does the h2xs -x switch not generate XSUBs?
by syphilis (Archbishop) on Jul 24, 2009 at 11:51 UTC | |
|
Re: Why does the h2xs -x switch not generate XSUBs?
by Anonymous Monk on Jul 24, 2009 at 09:58 UTC | |
by FloydATC (Deacon) on Jul 24, 2009 at 11:44 UTC | |
by ikegami (Patriarch) on Jul 24, 2009 at 16:17 UTC | |
by Anonymous Monk on Jul 24, 2009 at 12:14 UTC | |
by FloydATC (Deacon) on Jul 24, 2009 at 12:32 UTC | |
by Anonymous Monk on Jul 24, 2009 at 12:54 UTC | |
|