[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Chicken-users] passing a string to foreign-lambda*
From: |
John Cowan |
Subject: |
Re: [Chicken-users] passing a string to foreign-lambda* |
Date: |
Sun, 8 Jul 2007 15:29:09 -0400 |
User-agent: |
Mutt/1.5.13 (2006-08-11) |
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 address@hidden
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] passing a string to foreign-lambda*, Martin DeMello, 2007/07/08
- Re: [Chicken-users] passing a string to foreign-lambda*, Alex Queiroz, 2007/07/08
- Re: [Chicken-users] passing a string to foreign-lambda*, Martin DeMello, 2007/07/08
- Re: [Chicken-users] passing a string to foreign-lambda*, Alex Queiroz, 2007/07/08
- Re: [Chicken-users] passing a string to foreign-lambda*, Alex Queiroz, 2007/07/08
- Re: [Chicken-users] passing a string to foreign-lambda*, Alex Queiroz, 2007/07/08
- Re: [Chicken-users] passing a string to foreign-lambda*,
John Cowan <=
- Re: [Chicken-users] passing a string to foreign-lambda*, Martin DeMello, 2007/07/08
- Re: [Chicken-users] passing a string to foreign-lambda*, felix winkelmann, 2007/07/09
- Re: [Chicken-users] passing a string to foreign-lambda*, Martin DeMello, 2007/07/09
- Re: [Chicken-users] passing a string to foreign-lambda*, Graham Fawcett, 2007/07/09
- Re: [Chicken-users] passing a string to foreign-lambda*, felix winkelmann, 2007/07/10
- Re: [Chicken-users] passing a string to foreign-lambda*, Graham Fawcett, 2007/07/10