免费注册 查看新帖 |

Chinaunix

  平台 论坛 博客 文库
最近访问板块 发新帖
查看: 1718 | 回复: 0
打印 上一主题 下一主题

Win32::API是否支持double类型的参数? [复制链接]

论坛徽章:
0
跳转到指定楼层
1 [收藏(0)] [报告]
发表于 2009-10-11 11:48 |只看该作者 |倒序浏览
我想通过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编译的。

请高手们解答一下。
您需要登录后才可以回帖 登录 | 注册

本版积分规则 发表回复

  

北京盛拓优讯信息技术有限公司. 版权所有 京ICP备16024965号-6 北京市公安局海淀分局网监中心备案编号:11010802020122 niuxiaotong@pcpop.com 17352615567
未成年举报专区
中国互联网协会会员  联系我们:huangweiwei@itpub.net
感谢所有关心和支持过ChinaUnix的朋友们 转载本站内容请注明原作者名及出处

清除 Cookies - ChinaUnix - Archiver - WAP - TOP