This works well, but there is an upgrade that handles "cdecl"
calling convention, This one only handles the "stdcall" similar
to the pascal calling convention .
Expect a crash(stack overflow exception) if you call a dll that uses
__cdecl calling convention such as the functions inside msvcrt.dll
, msvcr71.dll or msvcp71.dll.
Without using __cdecl ,
your stack pointer will not be balanced after the call. You still
have to pop (or add esp, ???) the arguments you passed off the stack.
Many of the Microsoft dll's like kernel32.dll,user32.dll use the __stdcall calling convention. The C libraries use the C calling convention.
Also the upgrade will compile under vstudio.net 2003 see:
www.xs4all.nl/~itsme/projects/perl/ by Willem Jan Hengeveld
There is an extra option after the return type parameter for your
calling convention in your prototype '__stdcall' or '_cdecl',
the default is '__stdcall' .
I might develop another optional parameter that tests the stack
pointer before and after the call to print an error message if
the stack isn't balanced.