views:

1087

answers:

6

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).

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.

Any suggestions?

+2  A: 

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

tpdi
+1  A: 

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.

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.

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.

sybreon
+2  A: 

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

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.

Josh Kelley
+1  A: 

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.

veefu
+1  A: 

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.

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

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

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.

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.

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

Herbert Sitz
A: 

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)

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

lothar