crenz has asked for the wisdom of the Perl Monks concerning the following question:

When having to work on Win32, so far I have relied on Activestate Perl and pre-packaged PPM files. But every now and then, there are modules I need where I can't find a PPM file (e.g. Win32::MIDI, PAR), and which need a C compiler. What configuration do people use to compile XS modules, and what are the advantages/disadvantages? So far, I'm aware of the following choices:

I'm curious to know which one PerlMonks find the least hassle, and also which compiler module authors are usually writing for.

Replies are listed 'Best First'.
Re: Compiling XS modules on Win32
by Ovid (Cardinal) on Nov 26, 2002 at 20:27 UTC

    Unless I am greatly mistaken, XS requires that you use the compiler used to compile your Perl. Thus, you have no choice. perl -V (note the capital 'V') will give you more information about the compiler used and the options used with it. With Activestate, this should be cl.exe, which restricts you to the MS C++ compiler.

    Cheers,
    Ovid

    New address of my CGI Course.
    Silence is Evil (feel free to copy and distribute widely - note copyright text)

Re: Compiling XS modules on Win32
by PodMaster (Abbot) on Nov 27, 2002 at 10:07 UTC
    I have a ppm repository at http://crazyinsomniac.perlmonk.org/perl/ppm/
    http://crazyinsomniac.perlmonk.org/perl/ppm/5.8

    I take requests, mostly for ActivePerl flavored perl (build using MSVS), since if you got perl build using anything else, well, it's all free (borland ..., you don't need my help).

    I can put up Win32::MIDI and PAR if you wish (i'll do it).

    The advantages of cygwin is that it's a unix like environment, so almost everything will work without too much trouble, but there are some performance drawbacks associated with cygwin (no suprise there).

    The disadvantage to lcc-win32 and Borland and others is that most people don't use them, and that sometimes makefiles don't exist (not everyone uses ExtUtils::MakeMaker for their makefile generation).

    The advantage of MSVC is that practically every win32 port for which you can download a binary uses (activeperl,indigoperl), and all ppm repositories are msvc specific.


    MJD says you can't just make shit up and expect the computer to know what you mean, retardo!
    ** The Third rule of perl club is a statement of fact: pod is sexy.

      Thanks very much, podmaster -- I already installed the PPMs from your server!

      Thanks also to the others -- your answers really helped me. Fortunately I have VC++ 6 lying around (got it for ~ S$15, but that is another story), so I'll go and give it a try.

Re: Compiling XS modules on Win32
by gjb (Vicar) on Nov 26, 2002 at 23:40 UTC

    If you're going with ActiveState Perl, you have no choice but to use MS VC++. Support for other C compilers is currently (Perl 5.6.1, build 631) non-existent. Most things I tried seem to work.

    I also use the Perl that comes with cygwin and of course gcc to build the XS and that works fine as well.

    Hope this helps, -gjb-

Re: Compiling XS modules on Win32
by BUU (Prior) on Nov 27, 2002 at 00:11 UTC
    Why the hell are all these open source thingies built using MICROSOFTS COMPILER. Good god. Why don't they used the windows port of gcc? Or even borlandc, atleast that things free.
      Or better yet, why care what compiler was used? We can link to OS functions from any compiler, so we know they all have this common ground.

      Why use Microsoft's compiler? Probably because that's what most developers on that platform are using, and they aim to that market. Those using gnu on Windows don't need ActiveState in the first place (anymore) but can just compile the Perl source for themselves.

      —John

      I think I remember seeing a mailing list post about that (and please correct me if I'm wrong here). The reason was that VC++ ... *gasp* generated the best code!

      So if you want a needlessly crappy perl.exe, help yourself.

      /J

      I just remembered something. ActiveState was originally HIP, and they got a grant from Microsoft to port Perl 5 to win32, originally. So naturally they used MS's compiler, since it shipped in MS's Resource Kit for NT.