12.12.2012 Views

Teach Yourself Borland C++ in 14 Days - portal

Teach Yourself Borland C++ in 14 Days - portal

Teach Yourself Borland C++ in 14 Days - portal

SHOW MORE
SHOW LESS

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

The <strong>C++</strong>Builder IDE Explored: Projects and Forms<br />

Compil<strong>in</strong>g and Build<strong>in</strong>g Other <strong>C++</strong><br />

Programs<br />

<strong>C++</strong>Builder’s strength is <strong>in</strong> its visual programm<strong>in</strong>g environment. That environment is tied<br />

directly to VCL and cannot be separated from it. To get the most out of <strong>C++</strong>Builder, you<br />

will most likely be writ<strong>in</strong>g applications based on VCL. There are times, however, when<br />

you want to write other types of applications. <strong>C++</strong>Builder is a standard <strong>C++</strong> compiler, so you<br />

can compile any type of 32-bit <strong>C++</strong> program with <strong>C++</strong>Builder.<br />

Probably the most obvious type of “other” program you may want to build is a dynamic l<strong>in</strong>k<br />

library (DLL). DLLs might seem a bit like black magic, but they are really not very<br />

complicated; they are simply bits of compiled code that you can call from your application.<br />

Once you have the DLL created and your ma<strong>in</strong> program’s source file has the needed header,<br />

call<strong>in</strong>g a function conta<strong>in</strong>ed <strong>in</strong> a DLL is no different than call<strong>in</strong>g a function conta<strong>in</strong>ed <strong>in</strong> your<br />

ma<strong>in</strong> program.<br />

Another type of application you might write with <strong>C++</strong>Builder is the console application.<br />

Earlier we built several W<strong>in</strong>32 console applications when you were learn<strong>in</strong>g about the <strong>C++</strong><br />

language. Console applications are useful <strong>in</strong> teach<strong>in</strong>g situations and for quick test programs.<br />

They can also be very useful for small utility programs, servers such as Web servers or mail<br />

servers, and a whole host of other possibilities. Basically, any application that does not require<br />

a graphical <strong>in</strong>terface is a good candidate for a console application. Earlier <strong>in</strong> the chapter I<br />

talked about the <strong>C++</strong>Builder <strong>C++</strong> compiler, the resource compiler, and the <strong>C++</strong>Builder<br />

l<strong>in</strong>ker. All these programs are W<strong>in</strong>32 console applications that are executed from with<strong>in</strong><br />

<strong>C++</strong>Builder.<br />

You can also compile programs written <strong>in</strong> either MFC or OWL. This allows you to use a<br />

s<strong>in</strong>gle compiler for all of your development regardless of what framework you are us<strong>in</strong>g.<br />

Although you probably won’t develop full-scale MFC or OWL applications with <strong>C++</strong>Builder,<br />

there is certa<strong>in</strong>ly no reason you could not do so if you chose to. Of course, you would have<br />

to have the OWL or MFC library files and headers <strong>in</strong> order to build an OWL or MFC<br />

application. List<strong>in</strong>g 6.1 conta<strong>in</strong>s an OWL version of the Hello World program. First, set up<br />

<strong>C++</strong>Builder to build an OWL application (see the <strong>C++</strong>Builder documentation on how to<br />

configure <strong>C++</strong>Builder to build an OWL application). Then enter the program from the<br />

keyboard. Compile and run, and you’ve got an OWL program built with <strong>C++</strong>Builder.<br />

185<br />

6

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!