[Openmcl-devel] foreign fn call

Philippe Sismondi psismondi at arqux.com
Mon Mar 29 13:31:35 UTC 2010


On 2010-03-28, at 11:18 PM, Gary Byers wrote:

> 
> 
> On Sun, 28 Mar 2010, Philippe Sismondi wrote:
> 
>> I have taken a month or two away from CL to learn obj-c/cocoa so that I can
>> use the cocoa bridge more knowledgeably. Now I am reading up on foreign
>> functions etc. in the ccl documentation.
>> Question:
>> The ccl doc section 12.12 The Foreign-Function-Interface Dictionary gives
>> this example:
>> (with-cstrs ((format-string "the answer is: %d"))
>>          (#_printf format-string :int answer))
>> This just returns an integer (19) when I key it in to ccl. Should I expect
>> it to print what it looks like it would print? What else must I do here? (I
>> had set 'answer' to an integer value.)
>> 
> 
> The C function "printf" writes to a C "FILE *" associated with the process's
> standard output.  Where is that, exactly ?
> 
> If you're running in a terminal window, that's likely the terminal window.
> If you're running in an Emacs shell buffer, that's likely that shell buffer.
> ]
> <snip...>
>> 


Thanks, Gary. That clears it up.

After I posted I had lots of success using #_fopen, #_fprintf etc. from ccl. So the only complication was stdout which I can see no obvious need to use anyway. Trying examples from ccl documentation is just part of my learning process.

I'm a happy camper being back in the ccl world after my period of obj-c/cocoa learning. Obj-c and cocoa are pretty nice, but nowhere near as much fun as CL. So it's great to be able to get at C, obj-c and cocoa so nicely from ccl.

Best,

- Phil -

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.clozure.com/pipermail/openmcl-devel/attachments/20100329/6a20e906/attachment.html>


More information about the Openmcl-devel mailing list