[Enterprise Extensions only]

IDL pragma directives

IBM WebSphere Application Server supports the following pragmas:

For information on other preprocessor directives that can be used in IDL, see IDL include directives.

localonly pragma

This pragma supports the generation of bindings for objects that are known to be local (not distributed). This pragma can occur at any point in the IDL file following the definition or forward declaration of the designated interace.

The syntax is:

#pragma meta interface-name localonly

The IDL interface identified by interface-name is treated by generated bindings as strictly local to the caller's process. No calls to the CORBA ORB occur when invoking the operations defined in this interface. interface-name can be a simple name of an interface in the current scope or a fully- or partially-qualified interface name. The interface must be previously defined or forward declared when the pragma statement is encountered.

localonly abstract pragma

This pragma is like the localonly pragma, but it signifies an abstract function that cannot be instantiated. These types of interfaces are used to just define interfaces.

The syntax is:

#pragma meta interface-name localonly abstract

cpponly pragma

This pragma suppresses the generation of IOM interlanguage bindings.

The syntax is:

#pragma meta interface_name cpponly

In the default case, without this pragma, two sets of bindings are produced:

Without this pragma, only the standard CORBA C++ bindings are produced.

init pragma

This pragma specifies a function to use to initialize newly created objects.

The syntax is:

#pragma meta method-name init

This pragma allows the IDL to specify the name of a function to be used to initialize the newly created method. When this pragma is not used, the emitters produce a _create() function that takes no parameters and does no initialization after the new object is created.

For example, if the IDL contains:

interface A 
{
   void initFunction(int);
};
#pragma meta A::initFunction init

the C++ class A that implements interface A will have a _create() function that takes an int parameter (because initFunction takes an int). Also, the code inside _create(int) creates a new instance of class A and then call initFunction(int) on the newly created object, passing along its int parameter.

ID pragma

This CORBA-defined pragma overrides the default RepositoryID for an IDL entity.

The syntax is:

#pragma ID scoped-name literal-string

which sets the RepositoryID of scoped-name to literal-string instead of the default Repository ID.

Prefix pragma

This CORBA-defined pragma sets the RepositoryID prefix

The syntax is:

#pragma prefix string

which sets the current prefix used in generating OMG IDL format RepositoryIDs. The specified prefix applies to RepositoryIDs generated after the pragma until the end of the current scope is reached or another prefix pragma is encountered.

version pragma

This CORBA-defined pragma sets the RepositoryID version number.

The syntax is:

#pragma version scoped-name major.minor

which uses the major.minor as the version number for RepositoryID of the scoped-name.