#include __declspec(dllexport) short _stdcall test( short a, short b, short c, short d ) { return a+b+c+d; } #### LIBRARY TESTDLL.DLL EXPORTS test #### cl /LD testdll.c /link /DEF:testdll.def #### #! perl -slw use strict; use Win32::API::Prototype;; ApiLink( 'testdll', q[SHORT test( SHORT a, SHORT b, SHORT c, SHORT d )] ) or die $^E;; print "$_*4 = ", test( ($_) x 4 ) for 1 .. 10; __END__ C:\test>testdll 1*4 = 4 2*4 = 8 3*4 = 12 4*4 = 16 5*4 = 20 6*4 = 24 7*4 = 28 8*4 = 32 9*4 = 36 10*4 = 40 #### Dump of file testdll.dll ... ordinal hint RVA name 1 0 00001000 _test@16 #### Dump of file testdll.dll File Type: DLL ... ordinal hint RVA name 1 0 00001000 test #### #! perl -slw #use strict; use Win32::API::Prototype;; ApiLink( 'testdll', q[SHORT _test@16( SHORT a, SHORT b, SHORT c, SHORT d )] ) or die $^E;; print "$_*4 = ", &{'_test@16'}( ($_) x 4 ) for 1 .. 10; __END__ C:\test>testdll 1*4 = 4 2*4 = 8 3*4 = 12 4*4 = 16 5*4 = 20 6*4 = 24 7*4 = 28 8*4 = 32 9*4 = 36 10*4 = 40 #### #include __declspec(dllexport) short _cdecl test( short a, short b, short c, short d ) { return a+b+c+d; } #### Dump of file testdll.dll ... ordinal hint RVA name 1 0 00001000 test #### #! perl -slw #use strict; use Win32::API::Prototype;; ApiLink( 'testdll', q[SHORT test( SHORT a, SHORT b, SHORT c, SHORT d )] ) or die $^E;; print "$_*4 = ", test( ($_) x 4 ) for 1 .. 10; __END__