Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How do I port code for Borland C++ builder to Linux?

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?

like image 566
ajanicij Avatar asked Apr 02 '09 17:04

ajanicij


3 Answers

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

like image 120
tpdi Avatar answered Sep 23 '22 21:09

tpdi


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.

like image 29
Herbert Sitz Avatar answered Sep 22 '22 21:09

Herbert Sitz


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.

like image 34
Josh Kelley Avatar answered Sep 25 '22 21:09

Josh Kelley