[Gambas-user] Get last errno from external function call
Benoit Minisini
benoit.minisini at gambas-basic.org
Thu Oct 6 17:23:44 CEST 2022
Le 06/10/2022 à 17:19, Matheus Castello a écrit :
>
>
> On 10/5/2022 8:30 PM, vuott--- via User wrote:
>> Out of curiosity, maybe you could also try "System.GetExternSymbol ()":
>>
>> Dim p As Pointer
>>
>> p = System.GetExternSymbol("libgpiod", "errno")
>>
>> Print Int@(p)
>>
>>
>
> What I was doing previously was getting the pointer reference calling
> `__errno_location`:
> https://gist.github.com/microhobby/245022469ffbcea1a07a7579839d90a2#file-main-module-L13
>
> That works too. What is actually overwriting the errno is the IDE's
> Debug session ...
> If you try to run in the IDE debugger this will not work, this will
> return 0 always. (Could you check if its reproducible in your side please?)
>
I can modify the debugger so that is saves and restore 'errno'.
--
Benoît Minisini.
More information about the User
mailing list