If int* doesn't work, I would use the following. It's basically the same as what you ended up doing using Inline::C, but in Pure Perl.
use Win32::API qw( ); my $register_client2 = Win32::API->new( $S{DLL_path}, 'RegisterClient2', 'PP', 'I', ); sub register_client2 { my $ip = $_[1]; my $id = pack('l', 0); # Allocate space my $rv = $register_client2->Call($id, $ip); $_[0] = unpack('l', $id); return $rv; } register_client2(my $id, $ip) or die;
If the return value is just a boolean, you could do something more perlish.
sub register_client2 { my ($ip) = @_; my $id = pack('l', 0); # Allocate space $register_client2->Call($id, $ip) or return (); return unpack('l', $id); } my ($id) = register_client2($ip) or die;
Note: psz would indicate char** rather than char*. That's confusing.
In reply to Re: Calling a function form an external DLL with Inline::C on windows
by ikegami
in thread Calling a function form an external DLL with Inline::C on windows
by Anonymous Monk
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |