On Jun 24, 2004, at 6:36 PM, Roman Y. Asper wrote:
Ok i did a x-sub Installation for a friend of mine and everything works fine, now he wants to split his c-file into different modules but wants to retain a single perl file which references all functions off the c-file for further use in perl application.
Is it enough to include all Modules in the API.xs, Manifest file and change the Makefile in the c Directory or doesn't it work that way.
you *can* #include a C file, but it's generally considered bad form.
you can have MakeMaker build any number of extra C files by adding their objects to MakeMaker's OBJECT key.
say you have Foo.pm, Foo.xs, extrafoo.h, extrafoo.c and otherfoo.c. both of the C files implement the stuff that is bound in the xs file.
WriteMakefile ( NAME => 'Foo', OBJECT => qw(Foo$(OBJ_EXT) extrafoo$(OBJ_EXT) otherfoo($OBJ_EXT)), );
will cause perl to generate a makefile which will compile and link those objects to create the extension.
use $(OBJ_EXT) rather than .o, because the object extension is not ".o" on some platforms (notably win32, where it's .obj).
-- Jolt is my co-pilot. -- Slogan on a giant paper airplane hung in Lobby 7 at MIT. http://hacks.mit.edu/