sierrathedog04 has asked for the wisdom of the Perl Monks concerning the following question:

My goal is to create a C extension to a Perl 5.005_02 installation using the XS module.

The first hint of trouble was that h2xs gave me a warning that "cppstdin not found."

After saying the necessary prayers to the Perl gods I succeeded in running 'perl Makefile' and 'make' without error.

However, when I run 'make test' I receive the following error message:

Can't find 'boot_EncryptPass2' symbol in blib/arch/auto/EncryptPass2/EncryptPass2.so'
EncryptPass2 is the name of the module I am trying to create using XS. But what is 'boot_EncryptPass2' and why do I need one? Neither the Srinivasan (Panther) book or the perlxstut documentation say anything about boot_ thingies.

I would really appreciate it if anyone who has knowledge of how to use XS to create a Perl module from C source code could help me. I know that Inline.pm is a better way to go but BikeNomad and I determined yesterday in SOPW that Inline.pm won't work properly in my development environment.

Replies are listed 'Best First'.
(tye)Re: My Perl XS Module Fails At 'make test'
by tye (Sage) on Jul 05, 2001 at 09:11 UTC

    Well, I don't see any smoking guns based on the little information you've given so far. Use "nm" on the EncryptPass2.so file to figure out what is in it. There may also be an "exports" file that determines which symbols in the shared library are externally visible (which is often referred to as being "universal"). The need for an "exports" file and the name of it I think are compiler-dependant so you'll have to do some digging.

    You can also check the generated *.c file to make sure that a boot_EncryptPass2 subroutine is present and how it is declared.

            - tye (but my friends call me "Tye")
Re: My Perl XS Module Fails At 'make test'
by bikeNomad (Priest) on Jul 05, 2001 at 09:42 UTC
    The manpage for DynaLoader mentions boot_$module names; this is apparently a standard call. From the manpage:

    bootstrap() Syntax: bootstrap($module) This is the normal entry point for automatic dynamic loading in Perl. It performs the following actions: · locates an auto/$module directory by searching @INC · uses dl_findfile() to determine the filename to load · sets @dl_require_symbols to "("boot_$module")" · executes an auto/$module/$module.bs file if it exists (typically used to add to @dl_resolve_using any files which are required to load the module on the current platform) · calls dl_load_flags() to determine how to load the file. · calls dl_load_file() to load the file · calls dl_undef_symbols() and warns if any sym­ bols are undefined · calls dl_find_symbol() for "boot_$module" · calls dl_install_xsub() to install it as "${module}::bootstrap" · calls &{"${module}::bootstrap"} to bootstrap the module (actually it uses the function ref­ erence returned by dl_install_xsub for speed)
Re: My Perl XS Module Fails At 'make test'
by sierrathedog04 (Hermit) on Jul 05, 2001 at 14:55 UTC
    I am promising myself that when I get to work this morning I will give up trying to get Inline.pm, SWIG or XS to work in my obsolete non-standard MP-RAS 5.005 environment.

    Thanks for clarifying that the boot_ thingie is associated with DynaLoader. Clearly if XS were working properly then boot_ would exist and be visible.

    My conclusion is that XS, like Inline.pm and SWIG (which wouldn't even compile. It seemed to expect a C++ compiler) are not the way to solve this problem.

    TMTOWTDI means not to knock yourself out trying to solve a problem in a particular way, because if that way is not working there is an easier way.