如何将Borland C ++构建器的代码移植到Linux?

时间:2021-10-11 04:48:11

I have source code for a Windows DLL that is written in C++ and uses Visual Component Library. Now my task is to port that to Linux, but I don't have source code for the VCL itself, or any kind of documentation (and I have never worked with Borland C++; in my Windows days I used MFC).

我有一个用C ++编写并使用Visual Component Library的Windows DLL的源代码。现在我的任务是将其移植到Linux,但我没有VCL本身的源代码或任何类型的文档(我从未使用过Borland C ++;在我的Windows时代,我使用过MFC)。

This should not be all that hard, since my DLL does not have any GUI: as far as I can see, it mostly uses VCL for multithreading. I ran into a class that inherits from TThread and that is where I got stuck. I did some search on the Internet, but found no documentation for VCL so far. I would like to avoid buying a book on Borland C++ Builder, because I don't have time to wait for it to arrive from the Amazon. I cannot consider buying the package for Windows, because at work I only have a Linux box.

这应该不是那么难,因为我的DLL没有任何GUI:据我所知,它主要使用VCL进行多线程处理。我遇到了一个继承自TThread的类,这就是我遇到的问题。我在互联网上做了一些搜索,但到目前为止没有找到VCL的文档。我想避免购买一本关于Borland C ++ Builder的书,因为我没有时间等待它从亚马逊到达。我不能考虑购买Windows的软件包,因为在工作中我只有一个Linux盒子。

Any suggestions?

6 个解决方案

#1


The VCL is documented on CodeGear's web site. TThread in particular is described here.

VLC记录在CodeGear的网站上。这里描述了TThread。

I've found the documentation on the threading-related components of the VCL to be rather sparse. This site has a much better description of the Delphi/VCL approach to threading.

我发现VCL的与线程相关的组件的文档相当稀疏。该站点对Delphi / VCL线程方法有了更好的描述。

#2


The Boost libraries, and wxWidgets, will provide analogs to the VCL classes.

Boost库和wxWidgets将为VCL类提供类似物。

#3


You should be aware that the VCL used by C++ Builder is written entirely in Delphi/ObjectPascal. c++ builder apps all involve c++ making use of delphi-based libraries.

您应该知道C ++ Builder使用的VCL完全是用Delphi / ObjectPascal编写的。 c ++ builder应用程序都涉及使用基于delphi的库的c ++。

The FreePascal/Lazarus open source project has reverse-engineered most of the VCL (almost all of the non-visual stuff and much of the visual stuff) and it runs natively on Linux. The non-visual VCL-compatible stuff is known as the "Free Component Library" ("FCL") http://www.freepascal.org/ http://www.freepascal.org/fcl/fcl.var

FreePascal / Lazarus开源项目对大部分VCL(几乎所有非可视内容和大部分可视内容)进行了逆向工程,并且它在Linux上本机运行。非可视VCL兼容的东西被称为“免费组件库”(“FCL”)http://www.freepascal.org/ http://www.freepascal.org/fcl/fcl.var

The source of the TThread implementation in the FCL should be easy enough to find.

FCL中TThread实现的来源应该很容易找到。

One option would be to rewrite in FreePascal, where language would change to ObjectPascal but calls to the VCL and usage of VCL components would be virtually identical.

一种选择是在FreePascal中重写,其中语言将更改为ObjectPascal但调用VCL并且VCL组件的使用几乎相同。

Another option might be to port to c++ on Linux and somehow make use of FreePascal's VCL from c++. I'm not sure of the practicality/feasibility of that. Someone at FreePascal's forums should be able to help answer that.

另一种选择可能是在Linux上移植到c ++,并以某种方式利用来自c ++的FreePascal的VCL。我不确定那是否具有实用性/可行性。 FreePascal论坛的某个人应该能够帮助回答这个问题。

So another option as someone has mentioned would just be to rewrite using some other threading library.

所以有人提到的另一个选择就是使用其他一些线程库重写。

#4


You can download their free compiler and try experimenting with it. It should be possible to run it under WINE at least. Maybe even under FreeDOS.

您可以下载他们的免费编译器并尝试使用它。应该可以至少在WINE下运行它。也许甚至在FreeDOS下。

It should be related to the TThread class in Delphi/Kylix. That is another alternative for exploring it. I do believe that the most important methods were run() and sync() but it's been ages since I used it.

它应该与Delphi / Kylix中的TThread类相关。这是探索它的另一种选择。我相信最重要的方法是run()和sync(),但是自从我使用它以来已经很久了。

However, if you plan to cleanly port the code to Linux, it may help to re-implement the TThread class yourself, using some boost libraries or something.

但是,如果您计划将代码干净地移植到Linux,那么使用一些boost库或其他东西自行重新实现TThread类可能会有所帮助。

#5


Many years ago, Borland released a version of their IDE for linux, marketed as Kylix. I'm not sure if it is still supported, but that might be the path of least resistance, for you.

很多年前,Borland发布了一个用于Linux的IDE版本,以Kylix的形式销售。我不确定它是否仍然受到支持,但对于你来说,这可能是阻力最小的道路。

#6


There are several libraries that provide frameworks like threading e.g. Boost (www.boost.org) or ACE (http://www.cs.wustl.edu/~schmidt/ACE.html)

有几个库提供了类似线程的框架,例如Boost(www.boost.org)或ACE(http://www.cs.wustl.edu/~schmidt/ACE.html)

It should be fairly easy to port the code to use one of these threading infrastructures.

将代码移植到使用这些线程基础结构之一应该相当容易。

#1


The VCL is documented on CodeGear's web site. TThread in particular is described here.

VLC记录在CodeGear的网站上。这里描述了TThread。

I've found the documentation on the threading-related components of the VCL to be rather sparse. This site has a much better description of the Delphi/VCL approach to threading.

我发现VCL的与线程相关的组件的文档相当稀疏。该站点对Delphi / VCL线程方法有了更好的描述。

#2


The Boost libraries, and wxWidgets, will provide analogs to the VCL classes.

Boost库和wxWidgets将为VCL类提供类似物。

#3


You should be aware that the VCL used by C++ Builder is written entirely in Delphi/ObjectPascal. c++ builder apps all involve c++ making use of delphi-based libraries.

您应该知道C ++ Builder使用的VCL完全是用Delphi / ObjectPascal编写的。 c ++ builder应用程序都涉及使用基于delphi的库的c ++。

The FreePascal/Lazarus open source project has reverse-engineered most of the VCL (almost all of the non-visual stuff and much of the visual stuff) and it runs natively on Linux. The non-visual VCL-compatible stuff is known as the "Free Component Library" ("FCL") http://www.freepascal.org/ http://www.freepascal.org/fcl/fcl.var

FreePascal / Lazarus开源项目对大部分VCL(几乎所有非可视内容和大部分可视内容)进行了逆向工程,并且它在Linux上本机运行。非可视VCL兼容的东西被称为“免费组件库”(“FCL”)http://www.freepascal.org/ http://www.freepascal.org/fcl/fcl.var

The source of the TThread implementation in the FCL should be easy enough to find.

FCL中TThread实现的来源应该很容易找到。

One option would be to rewrite in FreePascal, where language would change to ObjectPascal but calls to the VCL and usage of VCL components would be virtually identical.

一种选择是在FreePascal中重写,其中语言将更改为ObjectPascal但调用VCL并且VCL组件的使用几乎相同。

Another option might be to port to c++ on Linux and somehow make use of FreePascal's VCL from c++. I'm not sure of the practicality/feasibility of that. Someone at FreePascal's forums should be able to help answer that.

另一种选择可能是在Linux上移植到c ++,并以某种方式利用来自c ++的FreePascal的VCL。我不确定那是否具有实用性/可行性。 FreePascal论坛的某个人应该能够帮助回答这个问题。

So another option as someone has mentioned would just be to rewrite using some other threading library.

所以有人提到的另一个选择就是使用其他一些线程库重写。

#4


You can download their free compiler and try experimenting with it. It should be possible to run it under WINE at least. Maybe even under FreeDOS.

您可以下载他们的免费编译器并尝试使用它。应该可以至少在WINE下运行它。也许甚至在FreeDOS下。

It should be related to the TThread class in Delphi/Kylix. That is another alternative for exploring it. I do believe that the most important methods were run() and sync() but it's been ages since I used it.

它应该与Delphi / Kylix中的TThread类相关。这是探索它的另一种选择。我相信最重要的方法是run()和sync(),但是自从我使用它以来已经很久了。

However, if you plan to cleanly port the code to Linux, it may help to re-implement the TThread class yourself, using some boost libraries or something.

但是,如果您计划将代码干净地移植到Linux,那么使用一些boost库或其他东西自行重新实现TThread类可能会有所帮助。

#5


Many years ago, Borland released a version of their IDE for linux, marketed as Kylix. I'm not sure if it is still supported, but that might be the path of least resistance, for you.

很多年前,Borland发布了一个用于Linux的IDE版本,以Kylix的形式销售。我不确定它是否仍然受到支持,但对于你来说,这可能是阻力最小的道路。

#6


There are several libraries that provide frameworks like threading e.g. Boost (www.boost.org) or ACE (http://www.cs.wustl.edu/~schmidt/ACE.html)

有几个库提供了类似线程的框架,例如Boost(www.boost.org)或ACE(http://www.cs.wustl.edu/~schmidt/ACE.html)

It should be fairly easy to port the code to use one of these threading infrastructures.

将代码移植到使用这些线程基础结构之一应该相当容易。