[gambit-list] c-lambda behaviour...

David St-Hilaire sthilaid at iro.umontreal.ca
Wed Mar 26 15:55:15 EDT 2008


Hello!

In a simple example, I saw a weird or unexpected (from me) behaviour from the 
c-lambda function. Here is what I did:

(c-declare "#include <stdio.h>")
((c-lambda () void "printf(\"test: %d\\n\", 10);")

This worked just fine, but if I do:

(c-declare "#include <stdio.h>")
((c-lambda () void (string-append "printf(\"%d\\n\"," "10);"))

I get:

*** ERROR IN "/home/dave/temp/test.scm"@4.11 -- Third argument to 'c-lambda' 
must be a string

Why is that the c-lambda cannot or does not evaluate its arguments? Is this 
occuring because c-lambda is a macro?

I'd like it to evaluate my (string-append ...) because then, I could simplify 
the usage of the ffi with macros...

Thanks!

David

-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 252 bytes
Desc: OpenPGP digital signature
URL: <http://mailman.iro.umontreal.ca/pipermail/gambit-list/attachments/20080326/8d12ee77/attachment.sig>


More information about the Gambit-list mailing list