Browse Prior Art Database

C++ Object Oriented Executable Modules & Synchronizing Structures with Java Executable Objects

IP.com Disclosure Number: IPCOM000019907D
Original Publication Date: 2003-Oct-09
Included in the Prior Art Database: 2003-Oct-09
Document File: 3 page(s) / 39K

Publishing Venue

IBM

Abstract

Solve and enable C++ object-oriented executable modules and synchronizing structures with Java executable objects. Facilitate porting from multiple Java objects, maintaining the entire structure of the objects and enhancing maintainability of both modules side-by-side.

This text was extracted from a PDF file.
This is the abbreviated version, containing approximately 52% of the total text.

Page 1 of 3

  C++ Object Oriented Executable Modules & Synchronizing Structures with Java Executable Objects

  The technique outlined in this document solves and enables C++ object-oriented executable modules and synchronizing structures with Java* executable objects. This technique is especially useful when porting from multiple executable Java objects, maintaining the entire structure of the object and enhancing maintainability of both modules side-by-side.

Consider the case where there is a need for encapsulated executable objects in C++ and sharing of a library of static or non-static functions. In order for a single C++ module or file to be executable, it must have a "main" function. This poses a problem when multiple C++ objects declared in different files are to be re-used and compiled with different executables. C++ compilers will not allow multiple main functions when compiling.

The solution for this problem is to encapsulate the "main" function within each class in C++ and still allow the file & class to provide a static function library and have its encapsulated "main" method within the class. Then the same classes & functions may be re-used among many programs, utilities, & tools. Each tool may be dependent on other tools functionality.

The technique to provide this functionality in C++ is to provide all static & non-static functions along with the each main function, belonging to the class and when compiling for a particular executable, include a simple and easy to use stub function that contains the outer "main" function. This accomplishes the C++ requirement of one official main signature while allowing multiple encapsulated "main" methods within each class and/or function library. Each object maintains its ability be executed by providing the main function while the entry point for a single compilation uses the outer stub "main". Then when compiling multiple programs re-using all of the same objects, no code needs to change, only the choice of the outer stub function.

The recommended nomenclature is name the class & file after the name of the tool, utility, or program. Each tool, utility, or program's primary class should belong to its individual file with the same name. The encapsulated "main" and all s...