[Gambas-user] pigpio c library callback gives segmentation fault (11)

Steve stevjensen at aol.com
Mon Nov 19 19:53:43 CET 2018


The basic principal with qsort is to call back for sorting information 
while gambas is in the qsort call.

I have no problem with doing the equivalent code from the c module in 
question.

This c module sets up a signal. When the signal is received it executes 
the callback code in the c module.

I used stdout to display the called addresses and data during the signal 
initiated callbaak which are the same as before. Nothing got corrupted 
in the c execution and the thread id is the same.

The problem here seems to be that gambas is in its event loop at the 
point when the signal occurs rather than executing something in the c 
module.



On 11/19/2018 1:22 PM, Benoît Minisini wrote:
> Le 14/11/2018 à 02:14, Steve a écrit :
>> Some info.
>>
>> Address where Gambas thinks the function callback_left resides.
>>
>> Basic address: 76FA3008
>>
>> The Address and values received by the C code instantiating the call 
>> to callback_left.
>>
>> At CB init Addr 76fa3008, pi 0, gpio 23, edge 0
>>
>> The Address and values in use by the C code just before making the 
>> call to callback_left.
>>
>> At TimeOut Addr 76fa3008, pi 0, gpio 23, lvl 2, tick 741000663
>>
>> All the above match expectations.
>> Some possibilities:
>>   The address Gambas is handing out is some sort of offset from a 
>> base pointer. Perhaps object addr + func addr?
>> The way Gambas pops values off the stack is different from the way C 
>> pushes them on the stack or for that matter the way gambas pushes 
>> stuff on the stack when calling an extern function.
>>
>
> Gambas is a C program, it pops values off the stack exactly the same 
> way than any other C program or library made in C.
>
> Can you try to implement the example of the documentation? I.e. make 
> use of qsort() with a callback written in Gambas? If you don't see 
> what I mean, I will send you a little program.
>
> That way we will see if the problem may be in the interpreter or in 
> your library.
>
> Regards,
>



More information about the User mailing list