sub GetLocalAddr1 { my $self = shift; Win32::API::Struct->typedef( AmsNetId => qw( UCHAR b[6]; ) ); Win32::API::Struct->typedef( AmsAddr => qw( AmsNetId netId; USHORT port; ) ); Win32::API->Import("$self->{_Path2Dll}" => 'LONG _cdecl AdsGetLocalAddress(LPAmsAddr pt)'); my %pt; tie %pt, 'Win32::API::Struct'=> 'AmsAddr'; AdsGetLocalAddress(\%pt); }