CORBA Quick Start Using TAO with C++Builder 6

CORBA Quick Start Using TAO with C++Builder 6

CORBA Quick Start Using TAO with C++Builder 6 Christopher Kohlhoff ([email protected]) Tenermerx Pty Ltd. Copyright c 2002 ii Contents 1 Introduction 1 1.1 What is CORBA? ............................... 1 1.2 What is TAO? ................................. 2 1.3 Finding Information ............................. 2 1.4 Typographical Conventions ......................... 3 2 Programming with C++Builder and TAO 5 2.1 Creating a Project Using the Wizard .................... 5 2.2 Creating a Project Manually ......................... 7 2.2.1 Creating a Dynamically-Linked Console Project ......... 7 2.2.2 Creating a Statically-Linked Console Project ........... 9 2.2.3 Creating a Dynamically-Linked VCL Project ........... 10 2.2.4 Creating a Statically-Linked VCL Project ............. 12 2.3 Using Precompiled Headers ......................... 15 2.4 Using the IDL Compiler ........................... 15 3 Hello World - A Tutorial 17 3.1 Writing the IDL ................................ 17 3.2 Writing the Client ............................... 18 3.3 Writing the Server ............................... 22 3.4 Running the Application ........................... 27 4 VCL Hello World - A Tutorial 29 4.1 Writing the IDL ................................ 29 4.2 Writing the Client ............................... 30 4.3 Writing the Server ............................... 35 4.4 Running the Application ........................... 44 A Building and Installing ACE+TAO 45 A.1 Quick Build Instructions ........................... 45 A.2 Detailed Build Instructions .......................... 47 iii A.2.1 Checking System Requirements .................. 47 A.2.2 Creating a Configuration Header File ............... 47 A.2.3 Build Configurations ......................... 48 A.2.4 Build Steps .............................. 49 A.2.5 Using TAO from C++Builder .................... 50 iv Chapter 1 Introduction This CORBA Quick Start provides an overview of using C++Builder 6 with TAO to get you started developing CORBA applications. It also suggests where to look for further details about CORBA development in C++Builder. • Chapter 2 looks at the development of CORBA applications using C++Builder 6 and TAO, including creating a project, precompiled headers, and using the IDL compiler. • Chapter 3 takes you through the creation of a simple CORBA application to illustrate the basic steps involved in using TAO with C++Builder 6. It shows the use of CORBA in console programs. • Chapter 4 takes you through the creation of a VCL-based CORBA application to show how to use TAO in programs with graphical user interfaces. • Appendix A explains how to build and install ACE+TAO from source code using C++Builder 6. 1.1 What is CORBA? Common Object Request Broker Architecture (CORBA) is an open, vendor-independent specification for an architecture and infrastructure that allows applications to com- municate over networks. The core features of CORBA are: • A high-level Interface Definition Language (IDL), allowing applications to spec- ify their distributed communication in an object-oriented fashion. Introduction 1 What is TAO? • Standardised protocols, GIOP and IIOP, for on-the-wire CORBA communica- tion. • A set of programming APIs to address the middleware needs of client to server connectivity. These features allow all CORBA-based programs to interoperate, even though they may be written in almost any programming language, and running on almost any operating system or network. 1.2 What is TAO? TAO is a standard-compliant implementation of CORBA that is designed for ap- plications with high-performance and real-time requirements. TAO is freely avail- able, open source software, and has been developed by research groups at Washing- ton University and University of California at Irvine. TAO’s development has been funded by various industrial sponsors, and it is being actively used and enhanced by a large development community. 1.3 Finding Information The following web sites, newsgroups, mailing lists and books may provide useful further information about the use of CORBA and TAO. • The TAO project home page at http://www.cs.wustl.edu/˜schmidt/ TAO.html. Includes links to download the latest releases and documentation. • The OMG’s CORBA web site at http://www.corba.org provides an overview of CORBA and lists CORBA case studies and success stories. • The ACE+TAO mailing lists and newsgroup (http://www.cs.wustl.edu/ ˜schmidt/TAO-mail.html) are relatively high volume discussion forums that provide peer support for users of ACE and TAO. • OCI (http://www.ociweb.com) provides commercial support for TAO. • The book: Henning, Michi and Steve Vinoski (1999). Advanced CORBA Program- ming with C++. Addison-Wesley. 2 CORBA Quick Start - Using TAO with C++Builder 6 Typographical Conventions contains comprehensive information on the use of CORBA with C++, and is virtually essential reading for anyone doing CORBA development using C++. • The TAO with C++Builder page at http://www.tenermerx.com/tao_bcb includes information on building and using ACE and TAO with C++Builder. 1.4 Typographical Conventions This manual uses the typographical conventions outlined below to indicate special text. • IDL and C++ source code appears in fixed width type. • Environment variables and any commands you must type in appear in fixed width type. • File names appear as bold italic type. • Menu items, buttons and other user interface elements appear in sans serif type. Introduction 3 Typographical Conventions 4 CORBA Quick Start - Using TAO with C++Builder 6 Chapter 2 Programming with C++Builder and TAO This chapter provides an overview of the development of CORBA applications using C++Builder 6 and TAO, including creating a project, precompiled headers, and using the IDL compiler. 2.1 Creating a Project Using the Wizard The ACE+TAO C++Builder project wizards can be used to generate C++Builder IDE projects that use ACE or TAO. They also include support for generating some useful helper classes. If installed correctly, the wizards are found in the New Items dialog on a tab named ACE+TAO: Programming with C++Builder and TAO 5 Creating a Project Using the Wizard The items shown on the ACE+TAO tab are: • ACE Application: Wizard for creating VCL, console or Windows API applica- tions that use ACE only. • TAO Application: Wizard for creating VCL, console or Windows API applica- tions that use TAO. • ORB Thread: Wizard for generating a class descended from TThread that runs the ORB event loop in a background thread. • Reactor Thread: Wizard for generating a class that runs the default ACE reac- tor in a background thread. • VCL Method Request: Wizard for generating a class that provides access to the VCL Synchronize functionality from anywhere in a program. To create C++Builder IDE project that uses TAO, select TAO Application. The Create TAO Application dialog that appears presents the following options: • Application Type: Select whether to create a VCL, Windows API or console application. 6 CORBA Quick Start - Using TAO with C++Builder 6 Creating a Project Manually • Linkage: Choose whether to use dynamic or static versions of the ACE+TAO li- braries, and whether to use libraries that contain debugging information. Note that ACE+TAO prebuilt for C++Builder 6 only includes the dynamic libraries without debug information. • Precompiled Headers: Enable the use of precompiled headers, and set the name of the file to use to store the precompiled header information. • CORBA Libraries: Select the additional CORBA libraries to be linked into the application. • ACE+TAO Location: Specify the directory containing an installed version of ACE+TAO or an ACE+TAO source tree. The wizard can generate projects that use the ACE+TAO libraries and header files from either location. The code generated by the ACE+TAO wizards can be customised by editing the template files located in the same directory as the wizard package (the .bpl file). 2.2 Creating a Project Manually This section outlines how to manually create a C++Builder IDE project that uses TAO. 2.2.1 Creating a Dynamically-Linked Console Project Note: These instructions assume that you have either: • installed a pre-built copy of the dynamically-linked ACE+TAO libraries, executa- bles and header files; or • built and installed the dynamically-linked version of ACE+TAO according to the instructions in appendix A. 1. Create a new console application by going File→New→Other. and using the Console Wizard. Make sure that the source type is C++, and that both Multi Threaded and Console Application are checked. 2. TAO is built on top of the ACE library, so you need to initialise ACE from your program. This will be done automatically provided your main function has the argc and argv parameters: Programming with C++Builder and TAO 7 Creating a Project Manually #include <tao/corba.h> int main(int argc, char* argv[]) { // ... } 3. Go to Project→Options. , then to the Linker page and make sure that Use dynamic RTL is checked. 4. Still in the Project Options dialog, go to the Directories/Conditionals page. 5. Add the following directory to the include path: $(ACETAODIR)\include Note: See section A.2.5 if you have not set up the ACETAODIR environment variable. 6. Add this directory to the library path: $(ACETAODIR)\lib 7. Close the Project Options dialog. 8. Go to Project→Edit Option Source and add the following libraries to the end of the SPARELIBS value: ACE_b.lib TAO_b.lib You may add other TAO libraries as required for the CORBA Services and other TAO features. For example, to use the Naming Service you would add: TAO_CosNaming_b.lib 9. Save and close the project’s option source. 10. Build your application. 8 CORBA Quick Start - Using TAO with C++Builder 6 Creating a Project Manually 2.2.2 Creating a Statically-Linked Console Project Note: These instructions assume that you have built and installed the statically- linked version of ACE+TAO according to the instructions in appendix A. A pre-built statically-linked version is not available. 1. Create a new console application by going File→New→Other.

View Full Text

Details

  • File Type
    pdf
  • Upload Time
    -
  • Content Languages
    English
  • Upload User
    Anonymous/Not logged-in
  • File Pages
    54 Page
  • File Size
    -

Download

Channel Download Status
Express Download Enable

Copyright

We respect the copyrights and intellectual property rights of all users. All uploaded documents are either original works of the uploader or authorized works of the rightful owners.

  • Not to be reproduced or distributed without explicit permission.
  • Not used for commercial purposes outside of approved use cases.
  • Not used to infringe on the rights of the original creators.
  • If you believe any content infringes your copyright, please contact us immediately.

Support

For help with questions, suggestions, or problems, please contact us