On Wed, 24 Nov 2010, Anton Kavalenka wrote:

Dear All.

Currently to implement logger we use the following approach (the code was 
implemented for Delphi/Kylix/FPC).
Logger is intended for displaying in the GUI outputs of several threads and 
child processes and also for storage into internal bases.

Logic is the following:

Get stdout handle (duplicate it under linux),
create pipe,
replace the stdout (keeping the old stdout) for current process with write 
handle of pipe,

There are following problems with FPC
Under Windows: I have to call rewrite(output) for every thread which wants to 
useĀ  new (captured) stdout

So the questions:
How to force all the threads of process and all DLLs write into same captured 
stdout?

There is no way that I know of to avoid the rewrite(), since the file descriptor records for Input, Output and StdErr are threadvars. And the threadvars must be initialized on thread start.

How to revert stdout back (stop capturing)?

Close and reopen using the standard filedescriptors ?

Michael.
_______________________________________________
fpc-devel maillist  -  fpc-devel@lists.freepascal.org
http://lists.freepascal.org/mailman/listinfo/fpc-devel

Reply via email to