in reply to Win32::API cant define function
The reference to the integer is actually the reference to the first integer in an integer array, with the subsequent 3 array values also being used to store analogue results.
For functions that require blocks of memory, use a string of the appropriate size.
my $read_inputs = Win32::API->new("wsp", "ReadInputs", "P", "I"); sub ReadInputs { my $buf = "\x00" x (4 * 32/8); my $rv = $read_inputs->Call($buf); return ($rv, unpack('l4', $buf)); }
Update: Fixed name of function. Changed "->()" to "->Call()"
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: Win32::API cant define function
by BarneySimpson (Initiate) on Mar 29, 2010 at 00:51 UTC | |
by GrandFather (Saint) on Mar 29, 2010 at 01:09 UTC |