compiling perl as a static library on win32, "use" command

Discussion in 'Perl Misc' started by Torsten Mohr, Feb 24, 2004.

  1. Torsten Mohr

    Torsten Mohr Guest

    Hi,

    i managed to compile a static version of perl, now
    i have a perl58.lib that i can link with own programs.

    i did this by compiling perl from the sources with the
    "dmake" utility and adding an error command just after
    the DLL is created.
    I then took that command and changed some parameters
    (e.g. from -dll to -lib).

    There are lots of warnings, but it seems to work.

    The problem is, that when i let the LIB execute
    a perl script, it works ok.

    What i'd now also like to do is to let the script
    use the "use" command.

    But as there are no *.pm files anywhere, this fails.

    Can i somehow either:

    - add the perl modules i need to the LIB somehow and change
    the "use" command to not load the modules from the
    file system, but from internal memory

    or

    - break up the hierarchy of "use" and generate ONE large
    script that includes everything.


    Is something like this possible?


    Thanks for any hints,
    Torsten.
     
    Torsten Mohr, Feb 24, 2004
    #1
    1. Advertisements

  2. I can think of quite a few ways to help you get rid of that problem. ;-)
     
    Gunnar Hjalmarsson, Feb 24, 2004
    #2
    1. Advertisements

  3. Torsten Mohr

    Ben Morrow Guest

    Look at PAR; I think this may be what you want. As you are building your
    own perl embed you may want to adapt the code of PAR rather than use it
    directly.

    Remember that any modules with compiled components will need to be built
    into your static library.

    Ben
     
    Ben Morrow, Feb 24, 2004
    #3
  4. Torsten Mohr

    Sisyphus Guest

    You mean there's *no* '.pm' files *anywhere* ??
    Is that as it should be ? I've never used a static build of perl but I
    had always assumed that it would have the usual core modules that you
    could "use". How else would one, for example, "use Math::BigInt;" ?

    Cheers,
    Rob
     
    Sisyphus, Feb 25, 2004
    #4
  5. Torsten Mohr

    Torsten Mohr Guest

    Hi,
    you're right, my description was not correct. The modules can't
    be found along the embedded perls module search path. But that's
    the way i want it to be, it should not look for anything in the
    file system, it should use its internal functions.


    Best regards,
    Torsten.
     
    Torsten Mohr, Feb 25, 2004
    #5
  6. Torsten Mohr

    Torsten Mohr Guest

    Hi,
    thanks, i'll take a look at PAR.
    That's correct, thanks for that hint.

    By the way, i'm not too familiar with win32 programming, is there
    anything else to keep in mind if i compile perl as a static library,
    especially if i compile perl static?

    For example, in libperl58.dll, there is some initialisation in DllMain().
    If i use it statically, i need to call the code by hand, right?

    Anything else, e.g. some additional defines or undefines?


    Best regards,
    Torsten.
     
    Torsten Mohr, Feb 25, 2004
    #6
    1. Advertisements

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments (here). After that, you can post your question and our members will help you out.