#include #include "dll.h" extern "C" int __stdcall own_function(int arg) { printf("Hello from simplelib, arg = %d\n", arg); return 0; } #### g4 -c -I. -I/home/soren.hein/include -DPERL_USE_SAFE_PUTENV -U__STRICT_ANSI__ -g -fno-strict-aliasing -pipe -fstack-protector -DUSEIMPORTLIB -O3 "-I/usr/lib/perl5/5.14/i686-cygwin-threads-64int/CORE" simplelib.c g4 --shared -Wl,--enable-auto-import -Wl,--export-all-symbols -Wl,--enable-auto-image-base -L/usr/local/lib -fstack-protector simplelib.o -o simplelib.dll #### #include #include "dll.h" int main() { int ret; printf("Hello from main\n"); ret = own_function(5); } #### g4 -c -I. -I/home/soren.hein/include -DPERL_USE_SAFE_PUTENV -U__STRICT_ANSI__ -g -fno-strict-aliasing -pipe -fstack-protector -DUSEIMPORTLIB -O3 "-I/usr/lib/perl5/5.14/i686-cygwin-threads-64int/CORE" standalone.c g4 -Wl,--enable-auto-import -Wl,--export-all-symbols -Wl,--enable-auto-image-base -L/usr/local/lib -fstack-protector standalone.o -o standalone /home/soren.hein/testcase/xs/simplelib.dll #### Hello from main Hello from simplelib, arg = 5 #### #include "EXTERN.h" #include "perl.h" #include "XSUB.h" #include "dll.h" MODULE = Glue::IF PACKAGE = Glue::IF PROTOTYPES: ENABLE void own_function(inlist) SV * inlist INIT: int i, ret; PPCODE: printf("Hello from XS\n"); i = 17; ret = own_function(i); #### /usr/bin/perl.exe /usr/lib/perl5/5.14/ExtUtils/xsubpp -typemap /usr/lib/perl5/5.14/ExtUtils/typemap glue.xs > glue.xsc && mv glue.xsc glue.c g4 -c -I. -I/home/soren.hein/include -DPERL_USE_SAFE_PUTENV -U__STRICT_ANSI__ -g -fno-strict-aliasing -pipe -fstack-protector -DUSEIMPORTLIB -O3 "-I/usr/lib/perl5/5.14/i686-cygwin-threads-64int/CORE" glue.c rm -f DDS_IF.dll g4 --shared -Wl,--enable-auto-import -Wl,--export-all-symbols -Wl,--enable-auto-image-base -L/usr/local/lib -fstack-protector glue.o -o Glue.dll /usr/lib/perl5/5.14/i686-cygwin-threads-64int/CORE/cygperl5_14.dll /home/soren.hein/testcase/xs/simplelib.dll