1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41
|
sub fnImportFunction
{
my $function_ref = shift;
my $strFuncName = shift;
my $strParamString = shift;
my $strReturnString = shift;
if (!defined(&{$function_ref}))
{
my $bOK = Win32::API->Import(
'popeye_dll.dll',
$strFuncName,
$strParamString,
$strReturnString);
if ( $bOK == 0 )
{
Log( -1, "Error importing $strFuncName : $^E" );
}
else
{
Log( 2, "$strFuncName successfully imported" );
}
}
}
# puis plus loin, dans le code :
# Import 'transfert' function from C++ dll
# Params :
# IN :
# 1 string to write datas 'P'
# Returns
# 1 long 'N'
#
&fnImportFunction(\&fnSetString,'fnSetString','P','N');
# Et encore un peu plus loin, pour utiliser fnSetString
&fnSetString("$strVal"); |
Partager