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

I've written something with Inline which I'm happy with, and I'd like to try using SWIG. I've got strawberry 5.12, cygwin (without the perl distro), Windows 7, and the SWIG zip unzipped without anything else being done (no env vars set etc). Getting as far as the following took a fair bit of trial and error, but I'm now stuck with:

mimi@mimi-PC ~ $ export CYGWIN=nodosfilewarning mimi@mimi-PC ~ $ SRCS=C:/Users/mimi/swig/Examples/perl5/simple/example.c mimi@mimi-PC ~ $ OBJS=C:/Users/mimi/swig/Examples/perl5/simple/example.o mimi@mimi-PC ~ $ LIBPATH="-LC:/strawberry/perl/lib/CORE -LC:/strawberry/c/lib" mimi@mimi-PC ~ $ LIBS=-lperl512 mimi@mimi-PC ~ $ cd C:/Users/mimi/swig/Examples/perl5/simple mimi@mimi-PC /cygdrive/c/Users/mimi/swig/Examples/perl5/simple $ ../../../swig -perl5 example.i mimi@mimi-PC /cygdrive/c/Users/mimi/swig/Examples/perl5/simple $ gcc -c $SRCS mimi@mimi-PC /cygdrive/c/Users/mimi/swig/Examples/perl5/simple $ gcc -shared $OBJS $LIBPATH $LIBS -o example.dll mimi@mimi-PC /cygdrive/c/Users/mimi/swig/Examples/perl5/simple $ perl -Mexample Can't find 'boot_example' symbol in ./example.dll at example.pm line 11 Compilation failed in require. BEGIN failed--compilation aborted.

I have read this which is quite spare on exact detail that I can fathom.

So any help would be highly appreciated.

Replies are listed 'Best First'.
Re: Building a SWIG example on cygwin
by Anonymous Monk on Apr 16, 2011 at 17:39 UTC
    Mixing cygwin and mingw? Why?

      Brain fart? Actually using MakeMaker on DOS is a whole load easier. Here's the steps to a successful build if googling brings you this way:

      C:\Users\mimi\swig\Examples\perl5\simple>type makefile.pl use ExtUtils::MakeMaker; WriteMakefile( NAME => 'example', # Name of package LIBS => ['-lm'], # Name of custom libraries OBJECT => 'example.o example_wrap.o' # Object files ); C:\Users\mimi\swig\Examples\perl5\simple>perl makefile.pl . . . C:\Users\mimi\swig\Examples\perl5\simple>dmake . . . C:\Users\mimi\swig\Examples\perl5\simple>dmake install . . . C:\Users\mimi\swig\Examples\perl5\simple>perl runme.pl The gcd of 42 and 105 is 21 Foo = 3 Foo = 3.1415926