[fpc-devel] rtl_do_close is not called in the embedded and freertos targets

Kostas Michalopoulos badsector at runtimeterror.com
Mon Aug 21 12:00:08 CEST 2023

Hi all,

I was looking at the RTL code to see if the embedded target could be 
used as a workaround for unsupported OSes (e.g. some custom kernel) and 
noticed that there are some global function pointers used as callbacks 
for system-specific functionality - which is neat.

However i also noticed that the do_close procedure in sysfile.inc 
doesn't do anything (it is empty) and nothing calls the rtl_do_close 
callback (the other do_xxx procedures do call the equivalent rtl_do_xxx 
if they are set). I don't have any actual program to test that out, it 
was just something i noticed by reading the code but it seems like a bug 
to me as i can't see a way to close a file handle otherwise.

The code can be seen here:


My guess is that the code above should call rtl_do_close defined here:


...like it is done in the other procedures in the sysfile.inc file.

FWIW the code for freertos seems to be exactly the same - empty do_close 
despite there being a rtl_do_close callback (which isn't used anywhere).


More information about the fpc-devel mailing list