Velocity Reviews

Velocity Reviews (http://www.velocityreviews.com/forums/index.php)
-   Perl Misc (http://www.velocityreviews.com/forums/f67-perl-misc.html)
-   -   compiling perl as a static library on win32, "use" command (http://www.velocityreviews.com/forums/t885420-compiling-perl-as-a-static-library-on-win32-use-command.html)

Torsten Mohr 02-24-2004 09:42 PM

compiling perl as a static library on win32, "use" command
 
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.


Gunnar Hjalmarsson 02-24-2004 10:15 PM

Re: compiling perl as a static library on win32, "use" command
 
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


Ben Morrow 02-24-2004 11:24 PM

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

Torsten Mohr <tmohr@s.netic.de> 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.me.uk *

Sisyphus 02-25-2004 12:42 AM

Re: compiling perl as a static library on win32, "use" command
 
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.


Torsten Mohr 02-25-2004 07:39 PM

Re: compiling perl as a static library on win32, "use" command
 
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 02-25-2004 07:44 PM

Re: compiling perl as a static library on win32, "use" command
 
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.



All times are GMT. The time now is 02:20 AM.

Powered by vBulletin®. Copyright ©2000 - 2013, vBulletin Solutions, Inc.
SEO by vBSEO ©2010, Crawlability, Inc.


1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57