Writing C Modules with XS
=head1 AUTHOR
A. U. Thor, Ea.u.thor@a.galaxy.far.far.awayE
=head1 SEE ALSO
L.
=cut
Aside from the preceding changes, the module file is identical to the normal
Perl only module file generated by h2xs X. This similarity is more than skin deep XS
modules often contain a significant portion of their code in Perl, resorting to C
only when necessary. I'll demonstrate this style later in this chapter.
Makefile.PL The Makefile Generator
Like the module file, the Makefile.PL generated for XS modules (see Listing 9 2) is
the same as the Makefile.PL in Chapter 4, with a few additional lines.
Listing 9 2. Makefile.PL Generated by h2xs A n Gnome::MIME
use ExtUtils::MakeMaker;
# See lib/ExtUtils/MakeMaker.pm for details of how to influence
# the contents of the Makefile that is written.
WriteMakefile(
NAME => Gnome::MIME ,
VERSION_FROM => MIME.pm , # finds $VERSION
PREREQ_PM => {}, # e.g., Module::Name => 1.1
($] >= 5.005 ? ## Add these new keywords supported since 5.005
(ABSTRACT_FROM => MIME.pm , # retrieve abstract from module
AUTHOR => A. U. Thor ) : ()),
LIBS => [ ], # e.g., lm
DEFINE => , # e.g., DHAVE_SOMETHING
# Insert I. if you add *.h files later:
INC => , # e.g., I/usr/include/other
# Un comment this if you add C files to link with later:
# OBJECT => $(O_FILES) , # link all the C files too
);
20
209
9
footer
Our partners:
PHP: Hypertext Preprocessor Best Web Hosting
Java Web Hosting
Inexpensive Web Hosting
Jsp Web Hosting
Cheapest Web Hosting
Jsp Hosting
Cheap Hosting
Visionwebhosting.net Business web hosting division of Web
Design Plus. All rights reserved