jimbojones has asked for the wisdom of the Perl Monks concerning the following question:
Hello
I'm trying to use a simple windows .dll through the Win32::API utility. Every time I call a C-function that uses arguments, I get an exception that causes Perl to quit. I've broken it down to the following test example.
If I redefine the PerlTest function to take no input arguments, (i.e. return some static number), it works correctly. Also, the examples given in the POD concerning kernel32.dll functions also work correctly, including those with input arguments. This leads me to suspect I'm missing something when creating the C test.dll I'm using AS 586.811 and Win32::API v0.41 that I got through PPM from AS. Thanks in advance, Jimuse strict; use Win32::API; my $winPerlTest = Win32::API->new( 'test', 'PerlTest', 'I', 'I'); die "Can't import API PerlTest: $!\n" unless ( defined $winPerlTest); my $id = 137; my $return; $return = $winPerlTest->Call($id); print $return, "\n"; __DATA__ /* declaration of PerlTest C-function */ int PerlTest(int a) { return a+1; }
|
---|
Replies are listed 'Best First'. | |
---|---|
Re: Help avoiding exception in Win32::API ?
by Tanktalus (Canon) on Sep 14, 2005 at 21:10 UTC | |
by jimbojones (Friar) on Sep 14, 2005 at 22:24 UTC | |
Re: Help avoiding exception in Win32::API ?
by PodMaster (Abbot) on Sep 15, 2005 at 07:53 UTC | |
by jimbojones (Friar) on Sep 16, 2005 at 14:18 UTC | |
Re: Help avoiding exception in Win32::API ?
by jimbojones (Friar) on Sep 14, 2005 at 22:06 UTC |
Back to
Seekers of Perl Wisdom