开发者

How does Perl module(.pm) call corresponding .so?

开发者 https://www.devze.com 2023-03-16 01:09 出处:网络
I just compiled and run a hello world Perl extension,but I don\'t know the principle.How does the .pm call .开发者_开发问答so?It doesn\'t need to - the binary code defines some variables and functions

I just compiled and run a hello world Perl extension,but I don't know the principle.How does the .pm call .开发者_开发问答so?


It doesn't need to - the binary code defines some variables and functions in the module's namespace, they can be used just like regular variables. The .pm file only needs to ensure that .so is loaded when it is needed. This is done by the DynaLoader module. By inheriting from DynaLoader you make sure that your .so file is loaded when an unknown method is called on your class.

0

精彩评论

暂无评论...
验证码 换一张
取 消