in reply to Re: Unable to find ".al" file error
in thread Unable to find ".al" file error

Thanks for the link almut. I think I got some understanding of the .al files. I'm not sure how/why my perl script is looking for it though. I didnt see any reference to using AutoLoader in the SWIG instructions. I'm not sure the easiest way forward. For now, my goal is to get my C APIs running from Perl. I can live with slower performance if necessary in short term.

Steps till I ran into this problem

- I ran swig and generated a .pm file

- Modified my existing C API's build (Makefile) to compile the sources + the _wrap.c file generated by swig into a shared lib.

- Created a simple perl script with "use <mymodule>" and then invoked one API.

I did not use MakeMaker or ModuleMaker etc.

After I read about AutoLoader, AutoSplit, I wentahead and ran autosplit_list_modules on my module's .pm file. I see the lib/auto directories created, but no .al files are until the auto/ directory. Still debugging..any pointers will be helpful.

Replies are listed 'Best First'.
Re^3: Unable to find ".al" file error
by Anonymous Monk on Oct 11, 2009 at 07:36 UTC
    I'm not sure how/why my perl script is looking for it though.

    Because its using AutoLoader

      Hi,

      I guess it is used/invoked internally by perl. To avoid it, I put a "no AutoLoader;" at the start of my script, but the problem still persists.

        I think you'll find that the error message is a red herring.
        The problem is probably simply that the function can't be found.

        Under certain circumstances (depending upon how you've loaded Exporter and DynaLoader), if the foo function can't be found, perl then goes looking for foo.al. If foo.al can't be found, perl then complains about the absence of foo.al (though the sane thing to do would be to complain about the inability to find the foo function).

        I'm quite confident that once you work out why the function can't be found and fix that problem, the error will go away.

        Is the function you're trying to call exported ? Can you successfully call it by it's fully qualified name (ie MyModule::foo()) ?

        Here's an Inline::C demo of the issue:
        use warnings; use Inline C => <<'EOC'; void greet() { printf("Hello World\n"); } EOC greet_me();
        Run that and you'll get the message that greet_me.al can't be found. Obviously, the complaint should be that there's no such function as greet_me().

        Cheers,
        Rob
        The error reg the ".al" turned out to be a dumb mistake in the swig interface file (.i file). Instead of "%include myheader.h", I had typed "#include myheader.h".

        Now onto real problems :-)