免费注册 查看新帖 |

Chinaunix

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

1K不到的程序,用Perl2exe编译出来居然有1.5M之巨? [复制链接]

论坛徽章:
0
跳转到指定楼层
1 [收藏(0)] [报告]
发表于 2007-11-05 23:14 |只看该作者 |倒序浏览
是Win32::GUI的Sample代码,也就一个Hello world。
用Perl2exe编译出来1.5M之巨
这个,正常么?:em11:

#!perl -w

use strict;
use warnings;

use Win32::GUI();

# Create a window, saving it in variable $main

my $main = Win32::GUI::Window->new(
    -name   => 'Main',
    -width  => 100,
    -height => 100,
);

# Add a label to the window (by default a label

# has size big enough for its text and is positioned

# in the top left of its containing window)

$main->AddLabel(
    -text => "Hello, world",
);

# Show our main window

$main->Show();

# Enter the windows message loop, often referred

# to as the "dialog phase".

Win32::GUI::Dialog();

# When the message loopreturns control to our

# perl program, then the interaction with the

# GUI is complete, so we exit.

exit(0);

###################### ######################

# The Terminate event handler for a window

# named 'Main'.  Returning -1 causes the

# windows message loop to exit and return

# control to our perl program.

sub Main_Terminate {
    return -1;
}

论坛徽章:
0
2 [报告]
发表于 2007-11-06 19:52 |只看该作者
很正常的阿,perl2exe只是把所有用到的包和perl解释器一起打包,和编译完全是两个不同的概念的

论坛徽章:
0
3 [报告]
发表于 2007-11-06 22:52 |只看该作者
楼主可知这三个模块全加起来有多大?
use strict;
use warnings;
use Win32::GUI();

论坛徽章:
0
4 [报告]
发表于 2007-11-07 13:13 |只看该作者
昨天找了一整天资料。发现perl2exe好像是有这样的毛病。
有什么更好的编译方法么?有人说perlcc编译的小,但是perlcc又很怪异。。。不知道怎么配置。。

论坛徽章:
0
5 [报告]
发表于 2007-11-08 00:03 |只看该作者
perlapp?

论坛徽章:
0
6 [报告]
发表于 2007-11-08 09:48 |只看该作者
perlapp跟perl2exe差不多
一个只有一句 print "Hello word"; 的文件编译出来都是200多K

不过昨天终于通过perlcc编译没出什么错,上面的这句Helloword编出来只有60多k

很多人用ActivePerl的perlcc编译不出来,
报一个“Can't locate object method "IVX" via package "B::NV"”的错误
可以把B/C.pm的第650行中的

$xpvnvsect->add(sprintf("0, 0, 0, %d, %s", $sv->IVX, $val));

把上面的“I”改成“N”就可以编译成功,原因未知。

我昨天是用VC6 + ActivePerl 5.88终于是把helloworld编译出来,但是编译其它的程序的时候非常慢,编译期间占CPU一直是99%左右,
一个10K的perl程序,20分钟还没编译完,放弃了。

另外,好像perlcc不能编译GUI程序吧?

论坛徽章:
0
7 [报告]
发表于 2007-11-08 09:55 |只看该作者
另外,我试着在MinGW + ActivePerl 5.88环境下, perlcc编译时报

C:\MinGW\bin\..\lib\gcc\mingw32\3.4.5\..\..\..\..\mingw32\bin\ld.exe: cannot find -lperl

不知道有没有高人指导一下。

论坛徽章:
0
8 [报告]
发表于 2007-11-08 18:51 |只看该作者
原帖由 绿茵汗将 于 2007-11-8 09:55 发表
另外,我试着在MinGW + ActivePerl 5.88环境下, perlcc编译时报

C:\MinGW\bin\..\lib\gcc\mingw32\3.4.5\..\..\..\..\mingw32\bin\ld.exe: cannot find -lperl

不知道有没有高人指导一下。



据说ActivePerl自身是由nmake编译出来的,估计不好用MinGw编译ActivePerl的

论坛徽章:
0
9 [报告]
发表于 2007-11-08 21:37 |只看该作者
原帖由 socyno 于 2007-11-8 18:51 发表



据说ActivePerl自身是由nmake编译出来的,估计不好用MinGw编译ActivePerl的


OK。MinGW就不说了。

但是用perlcc + VC编译,我到目前也只成功编译出了一个Helloworld

编译其它的时候总有一个cl.exe的进程长期狂占CPU,却不见编译出什么东西来。

论坛徽章:
39
2017金鸡报晓
日期:2017-02-08 10:39:4219周年集字徽章-周
日期:2023-04-15 12:02:2715-16赛季CBA联赛之深圳
日期:2023-02-16 14:39:0220周年集字徽章-年
日期:2022-08-31 14:25:28黑曼巴
日期:2022-08-17 18:57:0919周年集字徽章-年
日期:2022-04-25 13:02:5920周年集字徽章-20	
日期:2022-03-29 11:10:4620周年集字徽章-年
日期:2022-03-14 22:35:1820周年集字徽章-周	
日期:2022-03-09 12:51:3220周年集字徽章-年
日期:2022-02-10 13:13:4420周年集字徽章-周	
日期:2022-02-03 12:09:4420周年集字徽章-20	
日期:2022-01-25 20:14:27
10 [报告]
发表于 2007-11-08 22:15 |只看该作者
本來就是就是解释型语言,何苦要去编译呢。
您需要登录后才可以回帖 登录 | 注册

本版积分规则 发表回复

  

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

清除 Cookies - ChinaUnix - Archiver - WAP - TOP