Hello Jeroen,
unfortunately the GLPK library does not guarantee that you are in a
consistent state after an error has occurred.
It would be much more preferable if every API function would signal an
error as a return code instead of trying to abort the program.
In my programs I always call glp_free_env() in the error hook function.
With glp_free_env you return all memory allocated by GLPK and can start
from an initial state. Unfortunately now all the references your program
holds are invalid.
/**
* This hook function will be processed if an error occured
* calling the glpk library.
*
* @param in pointer to long jump environment
*/
void glp_java_error_hook(void *in) {
glp_java_error_occured = 1;
/* free GLPK memory */
glp_free_env();
/* safely return */
longjmp(*((jmp_buf*)in), 1);
}
Best regards
Heinrich Schuchardt.
On 09.11.2015 05:57, Jeroen Demeyer wrote:
> On 2015-11-08 00:50, Andrew Makhorin wrote:
>> New API routine glp_at_error was added and documented. Thanks
>> to Jeroen Demeyer <[email protected]> for suggestion.
>
> There is one problem though: the new code does not reset the error
> indicator to 0 before calling err_hook(). So even if the error hook uses
> longjmp() to continue execution, the error state remains set.
>
> Jeroen.
>
> _______________________________________________
> Help-glpk mailing list
> [email protected]
> https://lists.gnu.org/mailman/listinfo/help-glpk
>
_______________________________________________
Help-glpk mailing list
[email protected]
https://lists.gnu.org/mailman/listinfo/help-glpk