重新编译RTL - 如果可能,那么怎么办? [英] Recompiling the RTL - if possible, then how?

查看:179
本文介绍了重新编译RTL - 如果可能,那么怎么办?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有这个渴望做一些实验,修改Delphi运行时库(RTL), system.pas 和喜欢的...的可能性...这是可能的不是吗?



我非常喜欢是的,但是你必须为一些汇编器魔法提供自定义的.obj文件,因为它们从未分发德尔福的官方来源。我很好,我只想知道。



我想用Delphi 7做这个实验,但是在任何其他版本的内部信息是正确的。这是与石器时代以来一直与德尔福合作的公司之一。



(我一直认为这是一个RTFM问题,答案是一个响亮的不!,但由于某些原因谷歌不会确认。)

解决方案

您可以重新编译



对于System.pas,您必须使用命令行编译器。



例如,这里是一个工作的批处理文件内容(有一些没有很好记录的命令行开关):

  del * .dcu / s 
c:\program files\borland\delphi7\bin\dcc32.exe-O + -Q -M -Y -Z - $ D + System.pas

这将重新编译System.pas和SysInit.pas(最低级RTL文件)。



但是为了使用您重新创建的dcu文件,您必须将包含更新的dcu文件的文件夹放入IDE的第一个位置:例如在Delphi 7中,它是选项/环境选项/库,然后将您的文件夹FIRST放在Libary路径和浏览路径字段中。



也许值得删除您的Delphi安装目录中的原始.dcu文件。



但请确保您不会更改本机的界面部分,否则您将遇到麻烦与其他未修改的RTL单元(或第三方组件)进行编译。您可以更改实现部分,应用修复或重写某些部分的速度等等,但不要更改接口部分以避免任何链接错误。



始终备份您正在更改的原始.pas和.dcu文件。做一些自动编译测试是一个好主意,以便您可以确保对RTL的修改不会增加任何回归。



我们做了这样一个我们的增强型运行时间库的RTL重新编译更好的低级RTL功能(主要是System.pas和SysUtils.pas)。专为Delphi 7和2007设计。对于更新的Delphi版本,您仍然可以使用相同的原理。


I have this craving to do some experiments with modifying the underbelly of the Delphi run time library (RTL), system.pas and the likes... It is possible or not?

I'm very fond of challenges like "yes, but you'll have to provide custom .obj files for some assembler wizardry because they were never distributed with the official Delphi source". Fine with me, I just want to know.

I want to do this experiment with Delphi 7, but inside information on any other version is fine. It is one of the perks of being with a company that worked with Delphi since the Stone Age.

(I always figured this to be one of those RTFM questions, with the answer being a resounding "NO!", but for some reason google won't confirm it.)

解决方案

You can recompile the RTL like any other unit.

For System.pas you must use the command line compiler.

For instance, here is a working batch file content (there is some not well documented command line switches):

del *.dcu /s
"c:\program files\borland\delphi7\bin\dcc32.exe" -O+ -Q -M -Y -Z -$D+ System.pas 

This will recompile System.pas and SysInit.pas (both lowest level RTL files).

But in order to use your recreated dcu files, you'll have to put the folder containing the updated dcu files into the first position of your IDE: for instance, in Delphi 7 it's Option / Environment Options / Library, then put your folder FIRST in both "Libary path" and "Browsing path" field.

And it's perhaps worth deleting the original .dcu files in your Delphi installation directory.

But be sure you won't change the "interface" part of the unit, or you'll have troubles with compiling with other not modified units of the RTL (or third-party components). You can change the "implementation" part, apply fixes or rewrite some part for speed or such, but don't change the "interface" part to avoid any linking error.

Always make a backup of the original .pas and .dcu files which you are changing. And it's a good idea to make some automated compilation test, so that you could be sure that your modifications of the RTL won't add any regression.

We made such a RTL recompilation for our Enhanced Run Time Library for better speed of low-level RTL functions (mostly System.pas and SysUtils.pas). Designed for Delphi 7 and 2007. For more recent Delphi version, you still can use the same principle.

这篇关于重新编译RTL - 如果可能,那么怎么办?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆