These instructions assume you want to create an executable that is
dynamically linked to TAO. To do this you need to have
built a release version of VCL-compatible
dynamically linked TAO libraries. They also assume that you have unpacked the
ACE+TAO source kit into a directory called C:\ACE_wrappers.
Create a new application by going File|New Application.
Create a new header file to use for pre-compiled headers, calling it
something like pch.h. In it, put:
#ifndef INCLUDE_PCH_H
#define INCLUDE_PCH_H
#include <vcl.h>
// We must disable this warning here since
// the IDE does not seem to like having both
// it and -w-rvl (Function should return a
// value) specified in the CFLAG1 variable.
#pragma option push -w-ccc
#include <tao/corba.h>
#pragma option pop
#endif // INCLUDE_PCH_H
You may add other header files that you wish to be pre-compiled.
In your .cpp files, replace occurrences of
#include <vcl.h>
with
#include "pch.h"
TAO uses the ACE library, so you need to initialise ACE from your
program. To do this you can add calls to ACE::init and
ACE::fini from startup and cleanup functions:
#pragma package(smart_init)
void ace_init(void)
{
#pragma startup ace_init
ACE::init();
}
void ace_fini(void)
{
#pragma exit ace_fini
ACE::fini();
}
WINAPI WinMain(HINSTANCE, HINSTANCE, LPSTR, int)
{
// ...
}
For VCL applications it is important that you have the line
#pragma package(smart_init)
so that the ACE::init and ACE::fini calls occur before
and after the VCL cleanup and initialisation respectively.
Go to Project|Options, then to the Linker page and make sure that
"Use dynamic RTL" is checked.
Still in the Project Options dialog, go to the Directories/Conditionals page.
Add the following directories to the include path:
C:\ACE_wrappers
C:\ACE_wrappers\TAO
C:\ACE_wrappers\TAO\orbsvcs
Tip: By entering your paths prefixed with "\\?\", such as
\\?\C:\ACE_wrappers, you can prevent C++Builder from automatically
changing them to relative paths when you close the Project Options dialog.
Add this directory to the library path:
C:\ACE_wrappers\bin\Dynamic\Release\Pascal
Add these conditional defines:
WIN32
ACE_HAS_DLL=1
TAO_HAS_DLL=1
TAO_ORBSVCS_HAS_DLL=1
ACE_USE_RCSID=0
Switch to the Compiler page, enable "selected" warnings only, and then disable these warnings:
Function should return a value (-wrvl)
Parameter is never used (-wpar)
Unreachable code (-wrch)
Still on the Compiler page, now in the Pre-compiled Headers section, change the file name to something like myapp.csm and stop after pch.h.
Close the Project Options dialog.
Go to Project|View Makefile (for C++Builder 5 Project|Edit Option Source) and add the following
libraries to the end of the SPARELIBS line:
ACE_bp.lib TAO_bp.lib ORBSVCS_bp.lib
You should also make sure that the LIBRARIES variable is on the ALLLIB line.
For example, with C++Builder 4:
ALLLIB = $(LIBFILES) $(LIBRARIES) import32.lib cw32mti.lib
-
When compiling IDL files (using tao_idl) add the command line option
-Wb,pch_include=pch.h
so that the generated source files will use your pre-compiled header file.
| |
In this section
Introduction
Obtaining TAO
Building TAO
Using TAO
Patches
Support
Feedback
|