Discussion:
Splitting up large XS file
(too old to reply)
Marvin Humphrey
2007-01-05 20:01:03 UTC
Permalink
Greets,

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 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?

Marvin Humphrey
Rectangular Research
http://www.rectangular.com/
Just Drieux Drieux
2007-01-06 00:38:24 UTC
Permalink
Post by Marvin Humphrey
Greets,
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 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?
Marvin Humphrey
Rectangular Research
http://www.rectangular.com/
most libraries are built up from a collection of *.c files,
and then built into a single library.... so that part is
clearly doable - but are you using the Build based
tools? or the standard h2xs tools???

ciao
drieux

----
Muppet
2007-01-06 01:56:49 UTC
Permalink
Post by Marvin Humphrey
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 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?
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.

Continue reading on narkive:
Loading...