C:\perlmonks747643>ls -lh total 12K -rw-rw-rw- 1 666 0 126 2009-03-03 01:31 myTest.cpp -rw-rw-rw- 1 666 0 49 2009-03-03 01:30 myTest.h -rw-rw-rw- 1 666 0 248 2009-03-03 01:35 myTest.pl C:\perlmonks747643>cat myTest.h extern "C" __declspec(dllexport) int test(int); C:\perlmonks747643>cat myTest.cpp #include "myTest.h" extern "C" __declspec(dllexport) int __stdcall test(int x) { x *= 2; return x; } C:\perlmonks747643>cat myTest.pl #!/usr/bin/perl -- use strict; use warnings; use Win32::API; use Win32::API::Callback; use Win32::API::Test; my $fun = Win32::API->new('myTest.dll', 'int test(int a)') or die $^E; my $Result = $fun->Call(12); print "12 * 2 = $Result\n"; C:\perlmonks747643>gcc -shared -o myTest.dll myTest.cpp -Wl,--add-stdcall-alias C:\perlmonks747643>ls -lh total 28K -rw-rw-rw- 1 666 0 126 2009-03-03 01:31 myTest.cpp -rw-rw-rw- 1 666 0 13K 2009-03-03 01:36 myTest.dll -rw-rw-rw- 1 666 0 49 2009-03-03 01:30 myTest.h -rw-rw-rw- 1 666 0 248 2009-03-03 01:35 myTest.pl C:\perlmonks747643>perl myTest.pl 12 * 2 = 24 C:\perlmonks747643>pexports -v myTest.dll ; .text: RVA: 00001000, File offset: 00000400 ; .data: RVA: 00002000, File offset: 00000c00 ; .rdata: RVA: 00003000, File offset: 00000e00 ; .bss: RVA: 00004000, File offset: 00000000 ; .edata: RVA: 00005000, File offset: 00001000 ; Reading exports from section: .edata ; Export table: myTest.dll ; Ordinal base: 1 ; Ordinal table RVA: 00005038 ; Name table RVA: 00005030 ; Export address table RVA: 00005028 LIBRARY myTest.dll EXPORTS test ; .text ; RVA 00001180 test@4 ; .text ; RVA 00001180 ; .idata: RVA: 00006000, File offset: 00001200 ; .reloc: RVA: 00007000, File offset: 00001400 C:\perlmonks747643>