[Gambas-user] Get last errno from external function call

Matheus Castello matheus at castello.eng.br
Thu Oct 6 17:10:26 CEST 2022



On 10/5/2022 3:36 PM, Benoit Minisini wrote:
> Le 05/10/2022 à 04:29, Matheus Castello a écrit :
>> Hi guys,
>>
>> I'm new to Gambas3, I'm trying to use it for embedded devices and I'm 
>> doing some external function calls. There is some way in Gambas3 to 
>> get, or Gambas runtime stores, the last errno from a external function 
>> call?
>>
>> I tried to get it directly from libc `__errno_location` but surely the 
>> runtime must be making other calls that are overwriting the errno.
>>
>> Thanks in advance,
>> Matheus Castello
>>
>> ----[ http://gambaswiki.org/wiki/doc/netiquette ]----
> 
> The 'System.Error' property returns the value of errno.
> 

Thanks to point it, it works.

But I think that I found a bug. While debugging, this does not works. I 
wasted sometime yesterday testing and it wasn't working, but then I saw 
that running the program outside of the Gambas IDE without debug it 
worked as expected.

Gist for my tests reference: 
https://gist.github.com/microhobby/2e0221e8c6e677d505d183c59064508a

BR,
Matheus Castello

> Regards,
> 


More information about the User mailing list