in reply to Win32::api v0.75 issue importing DLL
6. And optionally you can specify the calling convention, this defaults to '__stdcall', alternatively you can specify '_cdecl' or '__cdecl' (API > v0.68) or (API > v0.70_02) 'WINAPI', 'NTAPI', 'CALLBACK' (__stdcall), 'WINAPIV' (__cdecl) . False is __stdcall. Vararg functions are always cdecl. MS DLLs are typically stdcall. Non-MS DLLs are typically cdecl.
from http://search.cpan.org/~bulkdd/Win32-API-0.75/API.pm#CALLING_AN_IMPORTED_FUNCTION.
You didn't post any code, but I will assume what is happening from "No crash calling a function without any input parameter. ". Win32::API did less error checking against wrong C prototypes in the past. By chance, (actually depending on what version/build number of Visual C or Mingw/GCC the Win32::API XS DLL was compiled with_, certain severe prototype mistakes (wrong number of params or __stdcall vs __cdecl mistake) in the past worked silently (but the C function might have been passed uninitialized memory). Under the hood, a 32 bit function that takes NO parameters (it may or may not have a return value) meets the definition of being __stdcall and __cdecl at the same time, so that will "magically work". ActiveState uses Visual C 6 for all 32 bit XS modules available through AS PPM, if you compile it yourself with "MSVc++ express" (version number??), that is a different compiler. I think your 0.65 came from ActiveState, and your 0.75 was compiled with a 21st century Visual C. On 64 bit Windows, __stdcall and __cdecl in Win32::API have no effect, so you can mess those 2 up in 64 bit Perl, and it will "magically work". Of course 32 bit portable is then gone because it will crash.
|
---|
Replies are listed 'Best First'. | |
---|---|
Re^2: Win32::api v0.75 issue importing DLL
by FabPerlExplorer (Initiate) on Mar 20, 2013 at 07:54 UTC |
In Section
Seekers of Perl Wisdom