You can't use \$ah with Win32::API.
The "P" type for parameters means that the address of the string in the variable is passed in. If you pass in \$ah for that argument, then you'll probably be passing in the address of a string like "SCALAR(0x1c7d220)".
Just pass in $ah and the C code will get a pointer to the string (which you correctly initialized to a 4-byte buffer) and can stuff the pointer into that buffer. Now, for ace_set_file, you want to pass the C pointer that got stuff into that string. This means that you can't use "P" for the first argument to ace_set_file, because it can only be used to pass the pointer to a Perl string and that pointer does not point to a Perl string.
Instead, use the argument type of "N" (for ace_set_file's first argument) and do: $ah= unpack("L",$ah); after the call to ace_init_addr.
Finally, I suggest you use strict which means you need to change code like [P, I, P] to something more like ["P","I","P"] or [qw(P I P)], despite the bad examples in the Win32::API documentation.
- tye (but my friends call me "Tye")In reply to (tye)Re: Win32::API help
by tye
in thread Win32::API help
by Eshock
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |