delphi中单独编译pas生成dcu文件

在网上下载了一个带源码的组件,结果碰到提示说缺少xxx.dcu。一看它的目录下确实没有,那能不能生成一个呢?

当然可以!

方法是使用delphi的安装目录/bin文件夹下的的dcc32.exe。

例如:

dcc32  myUnit.pas

正常情况下运行上面的命令就会编译myUnit.pas生成 myUnit.dcu文件。

(默认生成的.dcu是和.pas在同一文件夹下的)

下附该命令的使用方法和详细说明(来自大富翁论坛网友帖子):

DCC32的使用方法
文件介绍:
Delphi7/Bin/DCC32.EXE:编译器(必要)
Delphi7/Bin/rlink32.dll:用于连接资源文件(如果有资源文件时需要)
Delphi7/Bin/dcc32.cfg:配置文件(可选,主要用于指定“-u”参数路径)
创建一个批处理文件,如:Dcc.bat,存放在工程文件的目录下:
Dcc32 xxx. Dpr
如果要指定文件输出路径:
Dcc32 xxx. Dpr –e”c:/bin”
注意:-e和后面目录之间无空格。
运行批处理文件Dcc.bat,提示没有找到xxx,可以在/Delphi7/Lib/Debug或者是/Delphi7/Lib目录下找到,拷贝到工程文件目录即可。要不就直接用dcc32.cfg,打开dcc32.cfg文件你就可以看到“-u”参数指向的目录了。
这里把所有的文件都放在同一目录了,你可以重新调整,规范下。
最好在没有安装Delphi的机器上执行下,看还缺少哪些文件。
我也是刚接触没几天,只是用来编译一些只“uses SysUtils;”的Dll工程文件,所以我只用到几个文件:
Delphi7/Bin:
DCC32.EXE,rlink32.dll。
Delphi7/Lib/Debug:
SysConst.dcu,SysInit.dcu,System.dcu,SysUtils.dcu,Types.dcu,Windows.dcu。

DCC32 参数说明
选项    描述
Aunit=alias 设置单元别名
B      编译所有单元
CC     编译控制台程序
CG     编译图形界面程序
Ddefines  编译条件符号定义
Epath    可执行文件输出路径
Foffset   查找运行期间错误
GD     生成完整.Map文件
GP     生成.Map文件Public段
GS     生成.Map文件Segment段
H      输出提示信息
Ipaths   文件包含路径
J      生成.Obj目标文件
JP     生成C++类型.Obj目标文件
Kaddress  Set image base address
LEpath   包.BPL文件输出路径
LNpath   .dcp文件输出路径
LUpackage  使用运行期间包列表
M      编译有改动的源文件
Npath    dcu/dpu文件输出目录
Opaths   .Obj文件(汇编目标代码文件)路径
P      按8.3格式文件名查找
Q      安静模式
Rpaths   资源文件(.RES)路径
TXext    目标文件扩展名
Upaths   单元文件路径
V      为Turbo Debugger生成调试信息文件
VN     以.Giant格式生成包含命名空间的调试信息文件(将用于C++Builder)
VR     生成调试信息文件.rsm
W      输出警告信息
Z      Disable implicit compilation
$directive Compiler directives
–Help   显示编译选项的帮助。同样的,如果你在命令行单独输入dcc32,也会显示编译选项的帮助。
–version  显示产品名称和版本

 

Delphi组件安装方法,控件安装方
DELPHI 中的DCU破解
  • 0
    点赞
  • 2
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
delphi2-delphi2010 全支持 dcu 装换 pas -------------------------------------------------------------------------------- Project Dcu2Pas Version 1.3 Purpose Decompile a D2-D7, K1-K3's dcu(dpu) file to Delphi source as origin as possible, without or with minimal modifications, then recompile to new one under other Delphi versions Author Nengwen Zhuo(卓能文) Homes http://soarowl.uhome.net, http://www.websamba.com/soarowl, http://soarowl.0catch.com Emails soarowl@yeah.net, soarowl@sina.com.cn Released 2003-02-10 Lastest home/dl/Dcu2Pas.rar(zip) FOR RESTORE YOUR LOST SOURCES AND OPTIMIZE YOUR CODES ONLY!!! -------------------------------------------------------------------------------- This project is in very early stage, no document yet. To see some features, reference my test cases file -- test.pas and the output file test.int, please. The output maybe more clear organised than source files!!! For further development, any suggestions and ideas are welcome. I have no time to update my homepages for a long time ;-) -------------------------------------------------------------------------------- Usage Run Dcu2pas, set properly options, select a desired dcu file double click to decompile it -------------------------------------------------------------------------------- Features - Supports the following type declarations and their typed consts: * Type redeclarations, for example: type MyTypeString = type String; * All integer types(Byte, Cardinal, Int64, Integer, Longint, Longword, Shortint, Smallint, Word) * All char types(AnsiChar, Char, WideChar) * All boolean types(Boolean, ByteBool, LongBool, WordBool) * Enumerated type, subrange of enumerated type and set of enumerated type For examples: type Size = (Small = 5, Medium = 10, Large = Small + Medium); TMySize = Medium..Large; type TEnumSet = set of (Club, Diamond, Heart, Spade); const vcSet4: TEnumSet = [Club,Spade]; * All real types(Comp, Currency, Double, Extended, Real, Real48, Single) * All string types(AnsiString, ShortString, String, String[XX], WideString) * Array type(with/without packed keyword), dynamic array and multidimensional dynamic array * Set type * Record type, with any variant parts in records. But if a record has any variant parts in it, the typed const may can't correctly decompile * Function/procedure type declaration - Support threadvar - Support resourcestring - Support class type, interface inheritation - Support object type - Support interface - Code decompiler to BASM, then a decpompiled file can recompile under other Delphi versions... - Code decompiler to Object-Pascal. I have some ideas, but I have no time, maybe in near future, I will code for it! -------------------------------------------------------------------------------- Update history Legend: - Bug fixed * Algorithm enhanced + New featuer added Ver2.0 Ver1.3 2003-02-10 * Code decompiler redesigned * Partly support D7 Ver1.2 2002-07-28 + Delete procedure, contructor, destructor frame 2002-07-18 + Procedure variable const + Now can distinguish: vc1: PChar ='test'; vc2: PChar = @vc1; 2002-05-28(Ver1.1) + Now correctly process interface properties and argument default values + Support resources, for example: {%R *.dfm}, {$R *.res} 2002-05-26 + Support default arguments + Support interface 2002-05-25 + Support object type + Support resourcestring + Support threadvar + Support function/procedure type 2002-05-24 + Support file type + Support set of enumerated type const decompiler + Support enumerated type const decompiler + Support subrange of enumerated type + Support dynamic array type - Array [enumerted type] of ... - Bugs in [packed] array fixed - Bugs in [packed] record fixed - Bugs in enumerated type fixed - Bugs in classify interface and implement declarations fixed
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值