For example, let's look at the synopses for two routines, CPXgetobjval()
and CPXgetx()
, as they are documented in the ILOG CPLEX Reference Manual to clarify this calling convention. Here is the synopsis of the routine CPXgetobjval()
:
|
Then call CPXgetobjval()
in this way:
In contrast, here is the synopsis of the routine CPXgetx
():
|
The second method declares the array as a local variable, like this:
Then to see the optimal values for columns 5 through 104, for example, you could write this:
The variable objval_p
in the synopsis of CPXgetobjval()
and the variable x
in the synopsis of CPXgetx
() are both of type (double *)
. However, the suffix _p
in the parameter objval_p
indicates that you should use an address of a single variable in one call, while the lack of _p
in x
indicates that you should pass an array in the other.
For guidance about how to pass values to ILOG CPLEX routines from application languages such as FORTRAN or BASIC that conventionally call by reference, see Call by Reference in this manual, and consult the documentation for those languages.