Successful initialization verification
Under some circumstances, the library might be loaded into memory but not properly initialized. For example, if the environment variable CLIENT_LOCALE is set to an invalid locale, the GLS library does not properly initialize, and thus the library also does not properly initialize.
To allow application programs to verify that initialization
succeeded, several new members have been added to the ITFactoryList
class (defined in the public header file $INFORMIXDIR/incl/c++/itcppop.h):
class IT_EXPORTCLASS ITFactoryList
{
...
public:
// These are the built-in factory list initialization state values
enum InitState { NOTINIT, INITING, INITED };
// This function can be used to determine if the built-in factory
// list initialized properly. It returns
ITFactoryList::NOTINIT
// if initialization failed.
static InitState GetInitState();
...
};The user application calls GetInitState() before
using any classes or interfaces to determine if initialized
properly, as follows:
main(int, char *)
{
// check that Object Interface for C++ DLL initialized ok
if (ITFactoryList::GetInitState() == ITFactoryList::NOTINIT)
{
cout << "Error: Object Interface for C++ DLL not
initialized" <<
endl;
cout << "Error: exiting program" << endl;
return -1;
}
...