- 论坛徽章:
- 0
|
我想通过Win32::API来调用我的dll中的函数。如果参数是integer类型,能够正常调用,返回正确的计算结果。但是,如果参数是double类型,就会报错!
"Perl Command Line Interpreter has encountered a problem and needs to close. We are sorry for the inconvenience"
是不是Win32::API不支持double类型的参数?
#这个能正确调用
my $function=Win32::API->new('TestDLL', 'int foo1(int P, int T)');
my $return=$function->Call(100, 200);
#这个调用会出错
my $function2=Win32::API->new('TestDLL', 'double foo2(double P, double T)');
my $return2=$function2->Call(10.0, 20.0);
以为可能我的TestDLL.dll是用Delphi编译的,又测试《Perl高级编程(Profssional Perl Programming)》中的例子
use Win32::API;
# import the cos function
$cos = new Win32::API('msvcrt', 'cos', 'D', 'D');
# $cos is an object, use the Call() method on it
$result = $cos->Call(2.0);
print "cos(2.0) = $result\n";
仍然没有成功!这个msvcrt.dll应该是VC编译的。
请高手们解答一下。 |
|