|
| From: | Martin DeMello |
| Subject: | Re: [Chicken-users] passing a string to foreign-lambda* |
| Date: | Tue, 10 Jul 2007 03:51:47 +0530 |
On 7/9/07, felix winkelmann <address@hidden> wrote:
On 7/8/07, Martin DeMello <address@hidden> wrote:
>
> No, I want a C function whose body is a string generated by combining
> a template and some arguments that fill in slots in the template.
>
(define-macro (foo name x)
`(define ,name
(foreign-lambda* void ((c-string arg))
,(format #f "printf(\"~a, %s!\\n\", arg);" x) ) ) )
(foo hello "Hello")
(hello "martin")
Thanks! I was trying to use string-concatenate, but couldn't manage to make it available at macro expansion time (is this possible?) martin
| [Prev in Thread] | Current Thread | [Next in Thread] |