IBM ILOG Solver User's Manual > Extending the Library > Writing a Goal: Car Sequencing > Writing your own goal > Using ILOCPGOALWRAPPER to wrap the goals

There are several situations in which you might need to wrap a goal in an instance of IloGoal:

In such situations, use the macro ILOCPGOALWRAPPERn to wrap your goal.

For example, you can wrap the PrintAll goal in an instance of IloGoal in this way:

ILOCPGOALWRAPPER0(IloPrintAll, solver){
        return PrintAll(solver);
        }

To create an instance of this goal you write:

IloPrintAll(env);

The IloGoal object returned can then be passed as a parameter of the IloSolver::solve and IloSolver:startNewSearch functions.