I'm using PERL 5.8.8 and I've not found a way to read a PrivateKEY in format pkcs#8 in perl, so I'm trying to create a dll in C# that can do it, so I can call the methods from there.
I see that the module to do this is:
Win32::API
The example they show is this:
use Win32::API;
$function = Win32::API->new(
'mydll, 'int sum_integers(int a, int b)',
);
$return = $function->Call(3, 2);
The problem is that in the example I can have direct access to the function sum_integers but How can I call my function sum() with this structure from PERL?:
namespace testCreateDLLToUseInPERL
{
public class Test
{
public Test(){
}
public int sum(int n1, int n2)
{
return n1 + n2;
}
}
}
I've tried :
Win32::API::Struct->typedef( Test => qw{ });
Win32::API->Import('testCreateDLLToUseInPERL', 'Test::sum(int a, int b)');
my $myObj = Win32::API::Struct->new('Test');
print Dumper($myObj );
The above code fails with message:
the system could not find the environment option that was entered
$function = Win32::API->new(
'testCreateDLLToUseInPERL', 'int sum(int a, int b)',
);
print Dumper($function);
print Win32::FormatMessage( Win32::GetLastError() );
$return = $function->Call(3, 2);
print $return;
The above code fails with message:
The specified procedure could not be found
So, I understand that the DLL was loaded correctly but I've not provided a right path-to-follow to reach that function.
Any ideas?