I get a segmentation fault when writing to stdout or stderr inside a GPC module called from a C program. I guess I have to set something manually that would be set automatically by the pascal main that isn't set by a c main, but I can't find any reference to this problem in the documentation.
--Chris Ferrall
---------------------- C main --------------------- #include <stdio.h> extern Bug();
main () { Bug(); }
---------------------- Pascal module ----------------
module bug; uses GPC ;
procedure bug; External;
procedure bug; var f : text; begin rewrite(f,'cstring.txt'); writeln(f,'writing to text file okay '); close(f); (* Either of the following commands will cause a segmentation fault *) writeln('writing to standard output not okay'); writeln(StdErr,'writing to stderr not okay'); end;
end.
Christopher Ferrall wrote:
I get a segmentation fault when writing to stdout or stderr inside a GPC module called from a C program. I guess I have to set something manually that would be set automatically by the pascal main that isn't set by a c main, but I can't find any reference to this problem in the documentation.
See ~gpc/p/demos/gpc_c*
Frank