Beefy Boxes and Bandwidth Generously Provided by pair Networks
Syntactic Confectionery Delight
 
PerlMonks  

guts of Dynaloader

by xiaoyafeng (Chaplain)
on Apr 20, 2012 at 03:32 UTC ( #966068=perlquestion: print w/replies, xml ) Need Help??
xiaoyafeng has asked for the wisdom of the Perl Monks concerning the following question:

Hi gurus,

I'm now interested in guts Dynaloader. Where can I find the guts doc about it(and bootstrap etc.)

I reorganize my expression, hope it can make my question more clear.

I know perl put all dll/lib files in auto directory. and use it by Dynaloader. many years, I just use it, create it by h2xs. but don't think too much about its mechanics.

Along with my C knowledge rich up, I am more and more curious :

  • how perl call dynamic library in compile stage (use XYZ::XS module;)? I guess it seems like LoadLibrary function in windows
  • how perl call dynamic library in run time stage (require XYZ::XS module?)
  • I notice a bootstrap statement in pm file, what it does mean? and how does it work?
  • Please enlighten me~

    Thanks!





    I am trying to improve my English skills, if you see a mistake please feel free to reply or /msg me a correction

Replies are listed 'Best First'.
Re: internal about Dynaloader
by quester (Vicar) on Apr 20, 2012 at 06:19 UTC

    Dynaloader is a CPAN module, so a Google search for "cpan Dynaloader" will have the Dynaloader POD documentation as the first result. You could also get that with the command perldoc Dynaloader on a system with Perl (and Dynaloader) installed.

    You can look at the source code with the "Source" link near the top left of the CPAN web page. If you are on a Unix-like system, locate -i DynaLoader.pm should find a copy of the source code on your system.

    If you have a more specific question after looking through the source code feel free to ask.

Re: guts of Dynaloader
by syphilis (Chancellor) on Apr 20, 2012 at 12:13 UTC
    Both use XYZ::XS; and require XYZ::XS; load the dll in exactly the same way (by using LoadLibrary on Windows).

    The only difference (afaik) in the loading of the dll is in *when* it happens. If you use XYZ::XS; then the loading is done at script compile-time (whenever the compilation process gets to that compile-time command).
    And if you require XYZ::XS; then the loading is done at script run-time (whenever the execution process gets to that run-time command).

    Cheers,
    Rob
Re: internal about Dynaloader
by xiaoyafeng (Chaplain) on Apr 20, 2012 at 08:27 UTC
    hope the post updated can express my questions more clear. ;)




    I am trying to improve my English skills, if you see a mistake please feel free to reply or /msg me a correction

Re: internal about Dynaloader
by Anonymous Monk on Apr 20, 2012 at 05:24 UTC

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: perlquestion [id://966068]
Approved by BrowserUk
help
Chatterbox?
[marioroy]: choroba++, Discipulus++. It depends on the type of module. Data-type "only" modules are likely multi-process safe, re: Hash::Ordered, Tie::IxHash.
[marioroy]: ... when shared via MCE::Share-> share(...)
[marioroy]: Net type modules are likely not multi-process safe unless stated in the documentation.
[marioroy]: The Prima author fixed his module to be both thread and multi-process safe. Thanks Dmitry.
[marioroy]: Of all the GUI-type modules, Prima was the worst regarding thread/multi- process safety. Now, it's the best for safety. ;-)
[marioroy]: Tk, Gtk2, Gtk3 requires extra care.

How do I use this? | Other CB clients
Other Users?
Others contemplating the Monastery: (8)
As of 2017-09-22 10:13 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    During the recent solar eclipse, I:









    Results (260 votes). Check out past polls.

    Notices?