Re: Problem with one callback

"Eric Bezault ericb-D6Qt/9opevxWk0Htik3J/[email protected] [gobo-eiffel]" <[email protected]> Mon, 21 Oct 2019 09:26:48 +0200
Newsgroups gmane.comp.lang.eiffel.gobo.general
Message-ID <[email protected]>
Hi Germán,

> Hi, I'm having a problem with this code:
> 
> 
> int param_action(Ihandle* dialog, int param_index, void* user_data) {
>    return ((int (*) (EIF_REFERENCE, EIF_POINTER, EIF_INTEGER_32, 
> EIF_POINTER)) param_cb_FniV) (eif_access (obj), dialog, param_index, 
> user_data);
> }
> 
> int get_param_dialog (const char* title, void* user_data, const char* 
> format, int param_count, int param_extra, void** param_data) {
>    return IupGetParamv(title, param_action, user_data, format, 
> param_count, param_extra, param_data);
> }
> 
> 
> These functions are implemented in a header file (eiffel-iup.h). The 
> second function (get_param_dialog) call the IUP function "IupGetParamv" 
> which create a preferences panel. The second parameter (param_action) is 
> the callback called when the user change some value at preferences 
> panel. As you can see this is the first function, which call the Eiffel 
> routine "param_cb_FniV". The problem is that the application crash when 
> "IupGetParamv" is called. It seems to be the Eiffel routine 
> (param_cb_FniV is attached, I can check it with "param_cb_FniV != 
> NULL"). If I comment the line where this routine is called and add 
> "return 1;" below, the application run without problem. But I can't get 
> the changes made at panel. This is almost the same code I had with 
> Liberty Eiffel, only the line where the Eiffel routine is called was 
> changed. I don't see the problem here, but my C knowledge is basic. Any 
> Advice? Thanks.

I will need to see how `param_cb_FniV` is set?
The C code generated by `gec` may contain an extra argument to pass
information about the call stack. But if I remember correctly, when
passing `$f` to an external function, `gec` removes this extra argument.

set_param_cb_FniV (p: POINTER)
     external
         "C"
     alias
         "..."
     end

set_param_cb_FniV ($set_param_cb_FniV)

-- 
Eric Bezault
mailto:ericb-D6Qt/9opevxWk0Htik3J/[email protected]
http://www.gobosoft.com


------------------------------------
Posted by: Eric Bezault <ericb-D6Qt/9opevxWk0Htik3J/[email protected]>
------------------------------------

To Post a message, send it to:   [email protected]
To Unsubscribe, send a blank message to: [email protected]