ILOG CPLEX 11.0 User's Manual > Languages and APIs > ILOG CPLEX Callable Library > Using the Callable Library in an Application > Initialize the ILOG CPLEX Environment

ILOG CPLEX needs certain internal data structures to operate. In your own application, you use a routine from the Callable Library to initialize these data structures. You must initialize these data structures before your application calls any other routine in the ILOG CPLEX Callable Library.

To initialize a ILOG CPLEX environment, you must use the routine CPXopenCPLEX.

This routine checks for a valid ILOG CPLEX license and then returns a C pointer to the ILOG CPLEX environment that is creates. Your application then passes this C pointer to other ILOG CPLEX routines (except CPXmsg). As a developer, you decide for yourself whether the variable containing this pointer should be global or local in your application. Because the operation of checking the license can be relatively time consuming, it is strongly recommended that you call the CPXopenCPLEX routine only once, or as infrequently as possible, in a program that solves a sequence of problems.

A multithreaded application needs multiple ILOG CPLEX environments. Consequently, ILOG CPLEX allows more than one environment to exist at a time.

Note
An attempt to use a problem object in any environment other than the environment (or a child of that environment) where the problem object was created will raise an error.