[Openmcl-devel] stdout from called C funcs while using IDE

Paul Krueger plkrueger at comcast.net
Mon Apr 6 15:11:42 PDT 2009

I'm running the Cocoa IDE for CCL under Leopard. While working through  
some of the foreign function examples shown on http://ccl.clozure.com/manual/chapter12.10.html 
  I discovered that even though everything works as advertised from a  
CCL command line, when using the IDE the output from the C functions  
is sent to the system console rather than to either the listener  
window or the AltConsole window. I think maybe this is because the  
function try-connecting-to-altconsole in start.lisp uses a dup2 call  
to change stdin (fd 0), but doesn't actually change stdout (fd 1). It  
only changes the lisp symbol ccl::*stdout*. I tried to make what I  
thought was a simple change to fix this by adding a second #_dup2 call  
for fd 1, but when I tried to rebuild the IDE from the CCL command  
line it aborted while trying to save the new application, so I suspect  
there is something more subtle happening during the build.

This isn't really a problem for me given what I need to do, so I'm not  
going to spend any more time chasing it down. But I thought I'd  
mention it in case printf to stdout from a called C function is needed  
by someone.

Incidentally, there is a small typo on http://ccl.clozure.com/manual/chapter12.10.html 
. The include statement in the example code should be "#include  
<stdio.h>" rather than "#include <stdio.>". Most any C programmer  
would figure that out pretty quickly I'm sure.


More information about the Openmcl-devel mailing list