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. Advertising

  2. Torsten Mohr wrote:
    > The problem is, that when i let the LIB execute a perl script, it
    > works ok.


    I can think of quite a few ways to help you get rid of that problem. ;-)

    --
    Gunnar Hjalmarsson
    Email: http://www.gunnar.cc/cgi-bin/contact.pl
    Gunnar Hjalmarsson, Feb 24, 2004
    #2
    1. Advertising

  3. Torsten Mohr

    Ben Morrow Guest

    Torsten Mohr <> wrote:
    > 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


    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

    --
    And if you wanna make sense / Whatcha looking at me for? (Fiona Apple)
    * *
    Ben Morrow, Feb 24, 2004
    #3
  4. Torsten Mohr

    Sisyphus Guest

    Torsten Mohr wrote:

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


    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

    --
    To reply by email u have to take out the u in kalinaubears.
    Sisyphus, Feb 25, 2004
    #4
  5. Torsten Mohr

    Torsten Mohr Guest

    Hi,

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


    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,

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


    thanks, i'll take a look at PAR.

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


    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. Advertising

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

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Marco A. Cruz Q.

    Compiling perl 5.6 in WIN32 does not work

    Marco A. Cruz Q., Jul 6, 2004, in forum: Perl
    Replies:
    1
    Views:
    447
    Marco A. Cruz Q.
    Jul 8, 2004
  2. Torsten Mohr

    Building Perl for Win32 as a static library

    Torsten Mohr, Dec 28, 2003, in forum: Perl Misc
    Replies:
    2
    Views:
    130
    Torsten Mohr
    Dec 30, 2003
  3. Marco A. Cruz Q.

    HELP compiling Perl 5.6.0 in Win32 with BCC 5.5

    Marco A. Cruz Q., Jul 13, 2004, in forum: Perl Misc
    Replies:
    1
    Views:
    103
    Matt Garrish
    Jul 14, 2004
  4. Replies:
    2
    Views:
    159
    Tad McClellan
    Mar 26, 2005
  5. Thomas Steinbach

    win32 perl compiling problem

    Thomas Steinbach, Feb 8, 2009, in forum: Perl Misc
    Replies:
    10
    Views:
    257
    sisyphus
    Feb 11, 2009
Loading...

Share This Page