help-glpk
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Help-glpk] glpk 4.57 release information


From: Heinrich Schuchardt
Subject: Re: [Help-glpk] glpk 4.57 release information
Date: Mon, 09 Nov 2015 07:44:00 +0100
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:31.0) Gecko/20100101 Icedove/31.8.0

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 <address@hidden> 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
> address@hidden
> https://lists.gnu.org/mailman/listinfo/help-glpk
> 



reply via email to

[Prev in Thread] Current Thread [Next in Thread]