Greets,
I asked this question on the perl-xs mailing list...
I have an XS distro that has maybe 50 or 60 packages in it. My
strategy has been to put everything in one big XS file, so that
only one shared library gets compiled. However, the XS file is
now over 4000 lines, and the compilation time for the 10000-line
monolithic C file it generates is becoming an issue.
Is there a way to split up that C file so that fragments can be
conditionally compiled, yet still end up with only one shared
library?
And I got this reply...
Gtk2 uses over 150 XS files, all of which get compiled into a
single Gtk2.so. On the other hand, it also uses
ExtUtils::MakeMaker rather than Module::Build. The only trick was
supplying more than one XS filename to WriteMakefile().
If you have no problem getting Module::Build to build you a whole
bunch of C files into O files, then you can probably pre-parse the
XS into C with xsubpp --- but i have to imagine that there's a way
to get Module::Build to use multiple XS files.
However, I don't see a way to do this with M::B -- it seems that each
XS file gets compiled to a target C file, and it isn't possible to
shunt output from multiple XS files into one C file.
Maybe it's possible to hack something up with ExtUtils::ParseXS?
Marvin Humphrey
Rectangular Research
http://www.rectangular.com/