----- Original Message ----- From: "Foo Ji-Haw" . . > > Just an idea: is it possible to generate XS code via inline, then simply > write a separate module that called it do that inline is not used? >
Indeed it is. I do it often. In 'perldoc Inline-FAQ' , see the section 'How do I create a binary distribution using Inline?'. You need to do as suggested in steps 2) to 5). Not only must The C code be placed in a subdirectory, but I think the subdirectory needs to be named 'src', and the C file needs to be named the same as the '.pm' file - ie if the the '.pm' file is named 'Foo.pm', the C file has to be called 'Foo.c'. In the 'pm' file you must also specify the Config option CLEAN_AFTER_BUILD=>0. After you've run 'perl makefile.pl' and 'nmake' you can then go into the 'build' directory and retrieve the XS file (along with INLINE.h) that Inline created. Bundle those 2 files with an appropriate Makefile.PL, and '.pm' file (along with the usual Changes file, Readme file, test suite etc) and you have a normal cpan-type distro which can be built in the usual way - and is in no way dependent upon the Inline module. The '.pm' file that is part of the final distro will be a little different to the '.pm' file that you started with. Unlike the original '.pm' file it will require DynaLoader (and add DynaLoader to @ISA), it will need to call bootstrap (it's just one line of code - see any XS module's '.pm' file for an example of how to do that), and it will contain no reference to 'Inline C'. The final Makefile.PL also differs from the initial Makefile.PL that was used. It will 'use ExtUtils::MakeMaker;' instead of 'use Inline::MakeMaker;'. I actually wrote a little module (called C2XS) that takes the '.c' file that you have created for the Inline module to use, and converts that '.c' file into an '.xs' file. It also creates INLINE.h, iff needed. I could send it to you if you like - it just saves the bother of running the initial 'perl Makefile.PL' and 'nmake', and then having to go into the build directory and retrieve the XS file. It also means that you need only one '.pm' file (the one that's going to be part of the final cpan-type distro) and one Makefile.PL (the one that's going to be part of the final cpan-type distro). Cheers, Rob _______________________________________________ Perl-Win32-Users mailing list [email protected] To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs
