<div dir="ltr"><div dir="ltr">Thank you Michael and Jonas for your help and suggestions.  I think I ended up merging your suggestions, which does work for my corner case.  If anyone is interested this change can be viewed here: <a href="https://github.com/ccrause/freepascal/commit/b28ab72ed07f11677493d5d0e37ee451d2313323">https://github.com/ccrause/freepascal/commit/b28ab72ed07f11677493d5d0e37ee451d2313323</a></div><div dir="ltr"><br></div><div>I must admit that I was thoroughly confused by the apparent lack of semantic difference in use between InOutFunc and FlushFunc of TextRec structure.<br></div><div><br></div><div>Best wishes,</div><div>Christo</div><div><br></div><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Mon, Jun 8, 2020 at 9:58 PM Jonas Maebe <<a href="mailto:jonas@freepascal.org">jonas@freepascal.org</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">On 07/06/2020 19:16, Christo Crause via fpc-devel wrote:<br>
> I want to change the _haltproc for freertos ESP controllers to use<br>
> normal write/writeln functionality to send information to standard<br>
> output.  On these targets the output is typically buffered serial<br>
> provided by the OS.  Text output written just prior to setting the cpu<br>
> to sleep doesn't get sent, hence a flush is needed to complete data<br>
> transmission before putting the cpu to sleep.  Looking at<br>
> consoleio.OpenIO there doesn't seem to be a convenient way to provide a<br>
> flush helper function. Also the RTL Flush procedure calls InOutFunc and<br>
> not FlushFunc.<br>
> <br>
> What is the proper way to hook a flush helper function into the existing<br>
> RTL infrastructure?<br>
<br>
The flushfunc is called from fpc_write_end and fpc_writeln_end. Those<br>
helpers are automatically called after all of the individual write<br>
operations from a write(ln) statement have been processed. So if you<br>
implement/assign flushfunc and make it call your OS flush function, it<br>
should work fine.<br>
<br>
<br>
Jonas<br>
_______________________________________________<br>
fpc-devel maillist  -  <a href="mailto:fpc-devel@lists.freepascal.org" target="_blank">fpc-devel@lists.freepascal.org</a><br>
<a href="https://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-devel" rel="noreferrer" target="_blank">https://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-devel</a><br>
</blockquote></div></div>