Subj : Pascal vs C++ (LONG!!) To : Scott Adams From : Simon Woodland Date : Mon Oct 21 2002 09:27 pm Hello Scott! On 18/10/2002, Scott Adams wrote to Simon Woodland: -=>> Quoting Simon Woodland to Wayne Harms <=- SW>> There is hack on the internet that will let you turn Borland C++ SW>> into SW>> a Delphi complier. SA> Not heard of that hack..hmmm As taken from the PCPlus Issue 184 page 277/8 Delphi components with C++ Builder This month Dave Jewell delves into the wealth of Delphi components that are available for use within C++ Builder As promised last time, this month's C++Workshop takes a somewhat different format to usual. Rather than walking you through the development of a specific project, we're going to provide some pointers to the best Delphi components that are available for use with c++ Builder. If you're wondering why we're mentioning Delphi in C++ Workshop, you're probably not aware of the intimate relationship between these two development systems. Read on, and all will be revealed... As you're probably aware, Delphi and C++ Builder have a great deal in common; they are both Borland RAD development tools, and they both use the same VCL application framework. However, the relationship is a lot tighter than that. Delphi is based around the Pascal programming language and uses a lightning-fast compiler. Delphi appeared before C++ Builder and almost the entire Delphi development is itself written using Delphi. The only significant exceptions to this are the Pascal compiler (written in plain vanilla C), the debugger and the guts of the text editor - everything else is Delphi. When Borland came to create C++ Builder, it just didn't make sense to go to the huge effort of rewriting everything in C++. Instead, Borland simply modified the IDE where appropriate, connected it up to a C++ compiler and - hey presto - C++ Builder was born. OK, we're over- simplifying this somewhat, but hopefully you get the message: every time you fire up C++ Builder, you're actually running a Delphi application. When C++ Builder was first released, Borland was rather coy about this aspect of the product. Perhaps it figured that C++ programmers wouldn't like to know that it was using a development tool written in Pascal. The truth is, no matter how ardent a C++ developer you are, the Pascal under-the-hood nature of C++ Builder is great news. Why? Because it means that C++ Builder is fully compatible with the huge number of Delphi components that are available. We'll be looking at some of the better ones in the remainder of this months C++ Workshop. Incorporating Pascal code into a C++ project Although we have focused on adding Delphi-authored components to a C++ Builder project, there's nothing to stop you from incorporating any Pascal code into your C++ code To do this, simply click the Add File Project option on the IDE toolbar and select the .PAS file that you wish to incorporate into your project. This works because C++ Builder incorporates not only a full C++ compiler, but also a full Pascal compiler too - the same one used in Delphi. If you go to the Project Options dialog and select the Compiler tab, you'll be able to see a set of compiler options that are used to control the operation of the built-in Pascal compiler. The fact that C++ Builder includes a Pascal compiler makes it very easy to include Pascal code in your project, and to transparently create Pascal classes and invoke Pascal methods directory from a C++ program. As we've already pointed out, this happens all the time because all the out-of-the-box components on the C++ Builder component palette are Delphi- authored controls. Sadly this only works one way; whereas C++ has a built-in Pascal compiler, there isn't a C++ compiler built into the Delphi system. Oh well... we can't have everything. Regards, Simon Woodland --- APoint 1.25 * Origin: Simon's Little Corner of the world (2:250/501.5) .