# Sub all # cTblAtKey -> findInTableByKey # cTbl -> myTable # cCell -> myCell # ctbl_v2 -> myDll my $aKey = "UserName"; print $aKey."\n"; my $lengthaKey = length($aKey); print $lengthaKey."\n"; Win32::API::Struct->typedef(CSTRREF =>qw{int n; char* buffer}); my $structParameter = Win32::API::Struct->new('CSTRREF'); $structParameter->{n}=$lengthaKey; $structParameter->{buffer}=$aKey; # C function defined as: # myCell* findInTableByKey(myTable that, struct cRefStr key, unsigned offset); # with: # struct myCell { # unsigned char opaque[10]; #}; my $aKeyFunc = Win32::API->new("myDll.dll",'findInTableByKey', 'NSN','C','_cdecl'); if(not defined $aKeyFunc) { die "Couldn't load the function findInTableByKey from the dll"; } $cellPtr = $aKeyFunc->Call($outputTable,$structParameter,0);