![]() |
Overview Initializes the ORB, if necessary, and returns a pointer to it.
Original class CORBA Exceptions CORBA::SystemException
Intended Usage
This method is intended to be used by client or server applications to both initialize the ORB and obtain a pointer to it. This method can be called multiple times without adverse effect. The return value should be released using CORBA::release(ORB_ptr).
Initialization of data structures used for code-set translation between clients and servers is not done until ORB_init() is called, so that the application has an opportunity to first initialize its locale (for instance, using the XPG4 setlocale() function). Therefore, if a client or server process is configured to communicate with another process using a different character code set, or is configured to use ISO-Latin 1 as the transmission code set for remote messages, the application should initialize its locale (for example, using setlocale()), then call ORB_init(), prior to using the ORB or making remote method invocations.
Note: For workstation implementations, be sure to specify DSOM using the parameter argv or orb_identifier as described below.
IDL Syntax
typedef char* ORBid; static ORB_ptr ORB_init (int& argc, char** argv, ORBid orb_identifier);
Input parameters
- argc
- The number of strings in the argv array of strings. This is typically the argc parameter passed in to the main() function of the application.
- argv
- An array of strings, whose size is indicated by the argc parameter. This is typically the argv parameter passed in to the main() function of the application.
Note: For workstation impelmentation, if one of the strings in argv matches -ORBid "DSOM", then ORB initialization is performed, the matching string is consumed and argc is decremented (the remaining strings in argv may be reordered as part of consuming the -ORBid "DSOM" string). If argv is NULL or contains no string that matches -ORBid "DSOM", then the ORB is initialized only if the orb_identifier parameter is "DSOM".- orb_identifier
- A string that indicates which ORB to initialize.
Note: For workstation implementation, if no string in the argv parameter matches -ORBid "DSOM", the ORB is initialized only if the orb_identifier parameter is DSOM.
Return values
- CORBA::ORB_ptr
- A pointer to the ORB object. The return result should be released using CORBA::release(ORB_ptr).
Example
/* The following is a C++ example */ #include "corba.h" ... int main(int argc, char *argv[]) { char * orbid /* Initialize orbid. For CB workstation initialize to "DSOM" */ int rc = 0; /* Initialize the ORB and obtain a pointer to it */ CORBA::ORB_ptr p = CORBA::ORB_init(argc, argv, orbid); /* use p in the code */ ... return rc: }