Win32::API and 'short' argumentsby spurperl (Priest)
|on May 09, 2006 at 17:50 UTC||Need Help??|
spurperl has asked for the
wisdom of the Perl Monks concerning the following question:
I have a DLL, from which I want to call a function with the following signature (as specified in the .h file that comes with the DLL):
Importing (specifying SHORT as the type of all arguments in the new 'C declaration parsing' version, or 'ssss' in the old style) with Win32::API::Import seems to go fine. However, when I actually call the imported function, I get an access violation message box.
Curiously, when I declare the arguments to be integers ('iiii'), there's no access violation, although I'm still not sure I get back the same answer.
1) Has anyone run into such a problem ? What can cause it ?
2) How is the call actually executed with Win32::API, re argument packing ? Are they all appended into one big lump of bytes ?
3) My DLL comes from a 3rd party library for controlling a certain PCI card. They supply the DLL, the .h files and a .LIB import file for simpler linking from C/C++. C++ linking of this DLL works fine, and according to them it should also work without problems in VB, Delphi and LabView. So I suppose nothing should prevent it from working in Perl with Win32::API ? Should the DLL be compiled in some special way to work with Win32::API, or does it work with all DLLs ? Thanks in advance