开发者

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

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

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜