What is the modern way of creating an XS module fr

2019-03-23 18:14发布

I need to write an XS module for Perl. It is my understanding that h2xs is pretty much deprecated today, what is the preferred method for starting an XS module today? I looked at Module::Starter, but it only handles pure Perl modules.

标签: perl perl-xs
4条回答
贼婆χ
2楼-- · 2019-03-23 18:46

No, h2xs is not deprecated. Module::Starter is certainly more convenient if you create many pure Perl modules, but there's no reason to avoid h2xs. I would recommend reading all the way through its doc before using it, though, so that you know what all you might want it to do or not do.

查看更多
Juvenile、少年°
3楼-- · 2019-03-23 18:50

You should also look at using Inline::C

查看更多
来,给爷笑一个
4楼-- · 2019-03-23 18:51

Personally, whenever I start making a new module I just do it by cping and editing files from another module of mine that's similar to it, and editing as appropriate. Of course, nothing in that approach says it has to be one of mine. There's plenty of code on CPAN you can take copies of and be inspired by...

查看更多
再贱就再见
5楼-- · 2019-03-23 19:01

Personally I just use Module::Starter and add the .xs file myself. It depends on what your aim is: if you're making a one-on-one mapping to a C api then h2xs can do a lot of boilerplate for you, but if you're making a completely new interface, or when you're only doing things with perl itself (and not some external library) it doesn't add much but trouble IMHO.

查看更多
登录 后发表回答