Status and Return Values

The Callable Library routine CPXopenCPLEX() returns a pointer to a ILOG CPLEX environment. In case of failure, it returns a NULL pointer. The parameter *status_p (that is, one of its arguments) is set to 0 if the routine is successful; in case of failure, that parameter is set to a nonzero value that indicates the reason for the failure. Each failure value is unique and documented in the ILOG CPLEX Reference Manual.

The Callable Library routine CPXcreateprob() returns a pointer to a ILOG CPLEX problem object and sets its parameter *status_p to 0 (zero) to indicate success. In case of failure, it returns a NULL pointer and sets *status_p to a nonzero value indicating the reason for the failure.

Some query routines in the Callable Library return a nonzero value when they are successful. For example, CPXgetnumcols() returns the number of columns in the constraint matrix (that is, the number of variables in the problem object). However, most query routines return 0 (zero) indicating success of the query and entail one or more parameters (such as a buffer or character string) to contain the results of the query. For example, CPXgetrowname() returns the name of a row in its name parameter.

Most other routines in the Callable Library return an integer value, 0 (zero) indicating success of the call. A nonzero return value indicates a failure. Each failure value is unique and documented in the ILOG CPLEX Reference Manual.

We strongly recommend that your application check the status-whether the status is indicated by the return value or by a parameter-of the routine that it calls before it proceeds.


Previous Page: Problem Size and Memory Allocation Issues  Return to Top Next Page: Symbolic Constants