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

T

Torsten Mohr

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

Gunnar Hjalmarsson

Torsten said:
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. ;-)
 
B

Ben Morrow

Torsten Mohr said:
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
 
S

Sisyphus

Torsten said:
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
 
T

Torsten Mohr

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

Torsten Mohr

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.
 

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. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,768
Messages
2,569,574
Members
45,051
Latest member
CarleyMcCr

Latest Threads

Top