<div dir="ltr">Hello Michel, thanks for replying.<div><br></div><div>I'm using `cdecl`. :-)</div><div><br></div><div>The problem was related to C nested function: its life-cycle is strictly limited to the scope caller. Something like this:</div><div><br></div><div>some_global_function_using_a_nested_callback_function() {</div><div> some_nested_callback_function() { // << its life-cycle dies ...</div><div> }</div><div> some_callback_register(&some_nested_callback_function);</div><div>} // ... here! x-(</div><div><br></div><div>After declaring this code above, if you call `some_global_function_using_a_nested_callback_function()` in any place, you may get a terrible SIGSEGV. :-)</div><div><br></div><div>I declared it as nested function because I need to access the `some_global_function_using_a_nested_callback_function()`'s parameters, so finally I solved the problem just declaring an extra struct::</div><div><br></div><div>struct some_callback_handler {</div><div> my_particular_callback;</div><div> my_particular_callback_cls;</div><div>}</div><div><br></div><div><div>static some_global_callback_function(some_callback_handler) { // << at last, its life-cycle is global! ^.^</div><div> some_callback_handler.my_particular_callback(some_callback_handler.my_particular_callback_cls);</div><div>}</div></div><div><br></div><div><div>some_global_function_using_a_global_callback_function(the_xmlsec_callback) {</div><div> some_xmlsec_callback_register(global_handler, &some_global_callback_function);</div><div>}</div></div><div><br></div><div><a href="https://www.aleksey.com/pipermail/xmlsec/2017/010098.html">https://www.aleksey.com/pipermail/xmlsec/2017/010098.html</a><br></div><div><div class="gmail_extra"><br></div><div class="gmail_extra">Final implementation (without nested funcs): <a href="https://github.com/silvioprog/ws/blob/master/libmicroxml/src/microxml.c#L126">https://github.com/silvioprog/ws/blob/master/libmicroxml/src/microxml.c#L126</a> .</div><div class="gmail_extra"><br></div><div class="gmail_extra">I need to take care with nested functions in C, I think I'll never use it anymore. -.-</div><div class="gmail_extra"><br></div><div class="gmail_extra">Thanks!</div><div class="gmail_extra"><br></div><div class="gmail_extra">(I sent the last message to the Aleksey's e-mail by mistake hehe ^^' )</div><div class="gmail_extra"><br><div class="gmail_quote">On Fri, Jan 20, 2017 at 5:25 PM, iso8583 <span dir="ltr"><<a href="mailto:iso8583@free.fr" target="_blank">iso8583@free.fr</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div lang="FR"><div class="gmail-m_-3620293087203059889WordSection1"><p class="MsoNormal"><span lang="EN-US" style="font-size:11pt;font-family:calibri,sans-serif;color:rgb(31,73,125)">HI,<u></u><u></u></span></p><span class="gmail-"><p class="MsoNormal"><span lang="EN-US" style="font-size:11pt;font-family:calibri,sans-serif;color:rgb(31,73,125)"><u></u> <u></u></span></p><p class="MsoNormal"><span lang="EN-US" style="font-size:11pt;font-family:calibri,sans-serif;color:rgb(31,73,125)">> </span><span lang="EN-US">I can't understand why it doesn't work. It seems my local function has the same signature of `</span><span lang="EN-US" style="font-size:7.5pt;font-family:"courier new"">xmlGenericErrorFunc</span><span lang="EN-US">` function, but... :-(<u></u><u></u></span></p><p class="MsoNormal"><span lang="EN-US" style="font-size:11pt;font-family:calibri,sans-serif;color:rgb(31,73,125)"><u></u> <u></u></span></p></span><p class="MsoNormal"><span lang="EN-US" style="font-size:11pt;font-family:calibri,sans-serif;color:rgb(31,73,125)">As you mentioned you are working in Pascal, it may not be just because of the signature of the function. <u></u><u></u></span></p><p class="MsoNormal"><span lang="EN-US" style="font-size:11pt;font-family:calibri,sans-serif;color:rgb(31,73,125)">Is it not actually a ‘calling convention’ problem ?<u></u><u></u></span></p><p class="MsoNormal"><span lang="EN-US" style="font-size:11pt;font-family:calibri,sans-serif;color:rgb(31,73,125)"> <u></u><u></u></span></p><p class="MsoNormal"><span lang="EN-US" style="font-size:11pt;font-family:calibri,sans-serif;color:rgb(31,73,125)"><a href="https://en.wikipedia.org/wiki/X86_calling_conventions" target="_blank">https://en.wikipedia.org/wiki/<wbr>X86_calling_conventions</a><u></u><u></u></span></p><p class="MsoNormal"><span lang="EN-US" style="font-size:11pt;font-family:calibri,sans-serif;color:rgb(31,73,125)"><u></u> <u></u></span></p><p class="MsoNormal"><span lang="EN-US" style="font-size:11pt;font-family:calibri,sans-serif;color:rgb(31,73,125)">Hope it helps,<u></u><u></u></span></p><p class="MsoNormal"><span lang="EN-US" style="font-size:11pt;font-family:calibri,sans-serif;color:rgb(31,73,125)"><u></u> <u></u></span></p><p class="MsoNormal"><span lang="EN-US" style="font-size:11pt;font-family:calibri,sans-serif;color:rgb(31,73,125)">Regards,<u></u><u></u></span></p><p class="MsoNormal"><span lang="EN-US" style="font-size:11pt;font-family:calibri,sans-serif;color:rgb(31,73,125)"><u></u> <u></u></span></p><p class="MsoNormal"><span lang="EN-US" style="font-size:11pt;font-family:calibri,sans-serif;color:rgb(31,73,125)">Michel.<u></u><u></u></span></p></div></div></blockquote></div><div><br></div>-- <br><div class="gmail_signature"><div dir="ltr"><div>Silvio Clécio</div></div></div>
</div></div></div>