Alex Queiroz scripsit:

>     I guess this is better:
> 
> (define-macro make-foreign
>  (lambda (funcs)
>    (map
>     (lambda (func)
>       `(define ,func (foreign-lambda int ,(symbol->string func) int)))
>     funcs)))

Yes, that works.  However, it occurs to me that if what Martin actually
wants is a C function whose body is some string whose value
is not known until run-time, no amount of fiddling with macros will
accomplish that; C functions have to be known before run time so
they can be compiled.

The alternative is to use the tcc (tiny C compiler) egg, which lets
you construct and compile C functions at runtime and then invoke them.
Note that tcc only works on i386 platforms and requires glibc
(and therefore will not compile on Cygwin).

-- 
John Cowan                              [EMAIL PROTECTED]
            http://www.ccil.org/~cowan
Humpty Dump Dublin squeaks through his norse
                Humpty Dump Dublin hath a horrible vorse
But for all his kinks English / And his irismanx brogues
                Humpty Dump Dublin's grandada of all rogues.  --Cousin James


_______________________________________________
Chicken-users mailing list
Chicken-users@nongnu.org
http://lists.nongnu.org/mailman/listinfo/chicken-users

Reply via email to