spurperl has asked for the wisdom of the Perl Monks concerning the following question:
Hello monks,
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):
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
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.short WINAPI foo(short a, short b, short c, short d)
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
|
---|
Replies are listed 'Best First'. | |
---|---|
Re: Win32::API and 'short' arguments
by BrowserUk (Patriarch) on May 09, 2006 at 18:48 UTC | |
Re: Win32::API and 'short' arguments
by bart (Canon) on May 09, 2006 at 19:58 UTC | |
by spurperl (Priest) on May 09, 2006 at 20:28 UTC | |
by bart (Canon) on May 10, 2006 at 08:03 UTC | |
Re: Win32::API and 'short' arguments
by BrowserUk (Patriarch) on May 10, 2006 at 01:19 UTC | |
by spurperl (Priest) on May 10, 2006 at 03:51 UTC | |
by BrowserUk (Patriarch) on May 10, 2006 at 07:53 UTC | |
Re: Win32::API and 'short' arguments
by ikegami (Patriarch) on May 09, 2006 at 18:13 UTC |
Back to
Seekers of Perl Wisdom