http://www.perlmonks.org?node_id=249821


in reply to A Practical Guide to Compiling C based Modules under ActiveState using Microsoft C++

Obviously, it also helps to know a bit of C to successfully install modules that fail make. I don't know much C, but the stuff that will most likely bite you when installing/compiling C extensions are platform / header file differences.

My approach to hacking at a C extension is, that the C code in principle works and that the included Perl tests exercise the extension behaviour good enough to uncover most things I break when dabbling.

Things that I did to get stuff to compile :

So don't be afraid to change bits in the C header files to adjust the C code to what you think your machine actually is, but do pass these changes upstream to the module author - the next release might have your change already built in - and also be prepared for bugs in your modified versions - keep track of what you changed and which extensions you compiled yourself.

perl -MHTTP::Daemon -MHTTP::Response -MLWP::Simple -e ' ; # The $d = new HTTP::Daemon and fork and getprint $d->url and exit;#spider ($c = $d->accept())->get_request(); $c->send_response( new #in the HTTP::Response(200,$_,$_,qq(Just another Perl hacker\n))); ' # web

Replies are listed 'Best First'.
Re^2: A Practical Guide to Compiling C based Modules under ActiveState using Microsoft C++
by JRHeisey (Initiate) on Oct 22, 2015 at 17:20 UTC
    I thought I would add a caveat to this thread so others can find it.

    I use the Perl API on Windows with Visual Studio C++. While moving from Perl 5.8 to 5.20 the Perl API headers generated compile time errors.

    The first error was:

    c:\perl.5.20\lib\core\op_reg_common.h(58) : error C2144: syntax error +: 'void' should be preceded by ';'

    SE keywords: op_reg_common.h void preceded

    Someone in the IRC irc.perl.org #xs chat channel referenced here. http://sourceforge.net/p/staf/support-requests/180/

    Basically I needed to edit the config.h file from

    #define PERL_STATIC_INLINE static __inline__ /**/
    to
    #define PERL_STATIC_INLINE static __inline /**/
    I don't know why it wasn't defined with ifdefs for each compiler.

    J.R. Heisey