add NLPSolver callback functionality WITH A MEMORY LEAK, closes #866, see #879