将项目从 Delphi 3 移至 Delphi 2010
我被要求重新打开一个我在 1998/99 年用 Delphi 3 编写的项目,此后该项目一直稳定运行。我在一台老化的 Windows 98 机器上有 Delphi 3 代码库,它的存在只是为了让这个项目保持活力。显然,我希望在进行任何重大修改之前将源代码库带入 21 世纪。
我高兴地注意到,Delphi 2010(我目前使用的是 2007)声称能够从 Delphi 2 导入项目。有人有从 Delphi 3 导入大型项目的经验吗?我认为这是一个轻松的过渡还是困难的过渡?
此外,原始项目还使用了第三方组件,包括 DBISAM、WPTools 和 TMS Planner。我注意到所有这些仍然可用于最新版本的 Delphi。假设我首先将新版本安装到 Delphi 2010 中,我是否可以期望应用程序中使用这些组件的部分也能被翻译?我知道自原始应用程序中使用的版本以来,至少 WPTools 已经更改了它的一些组件结构和接口,显然我将在那里进行一些重新编码,但是程序的这些部分的失败是否会阻止我的代码库正在升级吗?
I've been asked to re-open a project I wrote in 1998/99 in Delphi 3 and which has been running stably since then. I have the Delphi 3 code base on an aging Windows 98 machine which exists only to keep this project alive. Obviously, I'd like to bring the source code base into the 21st century before undertaking any major revisions.
I note happily that Delphi 2010 (I'm currently on 2007) claims to be able to import projects from Delphi 2 on. Does anyone have any experience importing large projects from Delphi 3? Can I expect this to be an easy transition, or a difficult one?
In addition the original project makes use of third party components including DBISAM, WPTools, and TMS Planner. I note that all of these are still available for the latest release of Delphi. Assuming I first install the new versions into Delphi 2010 can I expect the parts of my application that use these components to be translated as well? I know that at least WPTools has changed some of its component structures and interfaces since the version used in the original application and obviously I'll have some recoding to do there, but will the failure of those parts of the program prevent my code base from being upgraded at all?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(7)
应该很有可能进行这种迁移,并且根据代码的编写方式,它可能会很痛苦,也可能不会很痛苦。不幸的是,在您开始迁移过程之前,很难说出具体是什么。
我要做的第一件事是确保所有 DFM 文件都转换为其文本表示形式。我相信在 Delphi 的更高版本中这被设置为默认值,但我记得 Delphi 3 使用了二进制格式。 delphi 3 bin 目录中应该有一个名为 DFMConvert 的实用程序文件或其他文件,它允许您将 DFM 转换为文本。您想要执行此操作的原因是为了确保在由于未加载组件而必须对 DFM 执行手动编辑时您可以读取源代码。您不仅会跳转 Delphi 的版本,还会跳转您使用的每个组件的版本,并且可能存在一些不兼容性,从而导致组件加载失败。我发现如果是这种情况并且您有一个“新”版本,则直接使用编辑 DFM 源并将测试表单及其上的组件与旧版本包含的内容进行比较。删除任何不合适的内容(或重命名),然后尝试再次加载表单。
正如 Frabricio 提到的,如果您使用变体,那么您将需要对您的使用条款进行细微调整。
好消息是,一旦纠正了组件/使用子句,您的代码本身应该可以正常工作。如果您直接进入 Delphi 2010,您唯一的其他问题将是 Unicode,并且编译器通过错误和警告向您指出所有这些问题,做得非常出色。
It should be very possible to do this migration, and depending on how your code is written, it may either be painful or painless. Unfortunately its not easy to say which until you start the migration process.
The first thing i would do would be to make sure that ALL DFM files are converted to their text representation. This I believe was set to default in later versions of Delphi but as I recall Delphi 3 used a binary format. There should be a utility file named DFMConvert or something in the delphi 3 bin directory which allows you to convert a DFM to text. The reason you will want to do this is to insure that you can read the source if you have to perform a hand edit of the DFM due to a component not loading. Not only are you jumping versions of Delphi, but you also are jumping versions of EVERY component you use and there may be a few incompatibilities that may cause a component to fail loading. I have found if this is the case and you have a "new" version, then use the edit the DFM source directly and compare a test form with the component on it against what your old version contains. Remove anything (or rename) that is out of place and then attempt to load the form again.
As Frabricio mentioned, if you use variants then you will need to make minor adjustments to your uses clause.
The good news is that your code itself should work fine once you get the components/uses clause corrected. If you go directly to Delphi 2010, your only other issue would be Unicode and the compiler does a fantastic job of pointing all of them out to you via errors and warnings.
由于您有 D2007 并假设所有这些组件集也都带有 D2007 dcus,我将
建议您首先尝试在 D2007 上重新打开代码库。之后,转到 D2010,因为实际 VCL 的 Unicode 功能 - 这可能会产生一些迁移问题(我不会在这里讨论,因为它在网络上和 此处)。
我之所以这么说,是因为在 D5 和 D7 之间(未准确记录)发生了 rtl 的单元重组(随着 Variants.pas 单元的创建和许多 OTAPI 单元更改名称等)。所以这就是你出现的第一个问题。编辑:不仅变体被重新定位,而且许多 IDE 集成内容也被重新定位 - 以避免部署未经许可的代码。如果您有一些 OTAPI 代码(例如,允许在继承表单上发布属性的代码),则需要将其重新定位到包项目。
正如skramradt所说,你可能必须处理二进制 DFM 的事情……
之后,如果一切正常,就转到 Unicode 的事情。根据应用程序的不同,这可能很简单,也可能很困难。对于我的人来说,并不是很烦恼。但我知道还有其他人面临着比我更大的问题。
As you have D2007 and assuming all these component sets come with D2007 dcus as well, I'll
advise you to first try reopen the codebase on D2007. And after that, go to D2010 because of the Unicode feature of the actual VCL - which can create some migration problems (which I'll not discuss here because it's deeply discussed on the web and here on SO).
I'd say that because somewhere between D5 and D7 (don't record exactly) happened an unit reorganization of the rtl (with the creation of the Variants.pas unit and many OTAPI units changed names, etc). So that will be where your first problems arise. EDIT:Not only Variants got relocated, but much IDE integration stuff too - to avoid unlicensed code to get deployed. If you have some OTAPI code (for example, code that allows published properties on inherited forms), it'll need to be relocated to a package project.
As skramradt said, you may have to deal with the binary DFM thing....
After that, if all works, go to the Unicode thing. Depending on the app, it can be easy or not. For mine ones, not of great annoyance. But I know there are others facing greater problems with it than me.
以下是我们关于升级到 Delphi 2010 的一些注意事项
我有大约 100 个应用程序 dll 和 COM 服务器需要升级。调试工作大概需要 12 周左右。希望这有帮助。
Here are a few notes we made regarding upgrading to Delphi 2010
I have about 100 applications dlls and COM servers to upgrade. Probably about 12 weeks work with commissioning. Hope this helps.
只是为了让您放心,我最近将我正在开发的软件从 Delphi 4 转换为 Delphi 2009 以获得 Unicode 功能,我遇到了很多问题,但它们都在几周内得到解决。
需要注意的一件事:如果您使用任何第 3 方软件包,请确保它们有可用的 Delphi 2010 版本,您可以在转换之前升级到该版本。 Delphi 2009 没问题,但我不会尝试在 D2010 中使用旧包。
Just to reassure you, I recently converted the software I am developing from Delphi 4 to Delphi 2009 to gain Unicode capabilities, and I had a number of issues, but they were all solvable within a couple of weeks.
One thing to note: If you use any 3rd party packages, make sure they have a Delphi 2010 version available that you can upgrade to before you convert. Delphi 2009 would be okay, but I would not try to use older packages in D2010.
关于将D3迁移到D2010我不能说太多,但我最近成功地将D6迁移到D2010。首先,我所做的就是确保您在 D3 中使用的所有第三方组件在 D2010 中也可用。重新编译从 D6 到 D2010 的任何定制组件。加载我的 D6 源代码并编译。处理所有 unicode 问题。一一处理所有编译器错误...全部在大约 3 天内完成(大约 30000 行代码)
I can't say much about migrating D3 to D2010, but I've recently migrated D6 to D2010 successfully. To begin with, what I did was to make sure that all third party components that you've used in D3 are also available in D2010. Recompile any custom built components from D6 to D2010. Loaded my D6 source code, and compile. Handle all unicode issues. Handle all the compiler errors one by one... all done in about 3 days (approx 30000 lines of code)
我有一个 Delphi 7 项目组,Delphi 2010 很容易升级。
不幸的是,在下次启动新创建的 Delphi 2010 项目组文件时,
加载项目后 IDE 就会崩溃并消失。没有显示异常,没有
错误消息。我的解决方法是始终使用 Delphi 7 文件并让 Delphi 2010
无需使用新创建的项目文件即可升级任何内容。
I have a Delphi 7 project group which Delphi 2010 readily upgraded.
Unfortunately, during the next start with the newly created Delphi 2010 project group files,
the IDE just crashes and vanishes after loading the project. No exceptions are shown, no
error messages. My workaround is using the Delphi 7 file all the time and let Delphi 2010
upgrade whatever it likes to without using the newly created project files.
我证实了其他人的说法:就您自己的代码而言,将 D3 应用程序转换为 D2010 通常很容易。
我看到两个困难:
最困难的部分是第三方组件。
看起来您使用的所有组件在 D2010 中仍然存在,这是一个很好的点。但很可能他们的界面已经改变,当然需要一些代码更改。
I confirm what the others are saying: converting a D3 application to D2010 is usually easy as far as your own code is concerned.
I see two difficulties:
The most difficult part are the 3rd party components.
It looks like all components you are using still exists for D2010, that is a good point. But it is likely that their interface has been changed and of course will require some code changes.