Hi, Is it possible to use preprocessor declarations in scheme code? If say: (c-declare #<<c-declare-end #define ABC 1000 c-declare-end ) Is there a way to use ABC when passing a value to a c-lambda? -aditya
Afficher les réponses par date
Hallo, On 11/10/09, Aditya Godbole <aag.lists@gmail.com> wrote:
Hi,
Is it possible to use preprocessor declarations in scheme code? If say:
(c-declare #<<c-declare-end
#define ABC 1000 c-declare-end )
Is there a way to use ABC when passing a value to a c-lambda?
You must create a variable in Scheme-land too: (define *ABC* ((c-lambda () int "___result = ABC;"))) Cheers, -- -alex @asandroq http://www.ventonegro.org/
On Tue, Nov 10, 2009 at 7:43 PM, Alex Queiroz <asandroq@gmail.com> wrote:
You must create a variable in Scheme-land too:
(define *ABC* ((c-lambda () int "___result = ABC;")))
I have a few header files that have quite a few of these declarations. I was wondering whether there was any easy way out, instead of going through the header files and writing a c-lambda for each one. -aditya
I think that James Long was working on some automatic ffi generating code. Maybe you can take a look at his code and see what he is doing and extract things relevant to you. Or just use what he has. On Tue, Nov 10, 2009 at 9:49 AM, Aditya Godbole <aag.lists@gmail.com> wrote:
On Tue, Nov 10, 2009 at 7:43 PM, Alex Queiroz <asandroq@gmail.com> wrote:
You must create a variable in Scheme-land too:
(define *ABC* ((c-lambda () int "___result = ABC;")))
I have a few header files that have quite a few of these declarations. I was wondering whether there was any easy way out, instead of going through the header files and writing a c-lambda for each one.
-aditya _______________________________________________ Gambit-list mailing list Gambit-list@iro.umontreal.ca https://webmail.iro.umontreal.ca/mailman/listinfo/gambit-list
On Tue, Nov 10, 2009 at 1:48 PM, Pavel Dudrenov <dudrenov@gmail.com> wrote:
I think that James Long was working on some automatic ffi generating code. Maybe you can take a look at his code and see what he is doing and extract things relevant to you. Or just use what he has.
Yeah, I worked on it. So did Jeremie and Christian, and a few others. I wrote "autoffi" which is just a prototype which tries to use SILex to parse C code. This code isn't maintained but hopefully still works. Pulling out definitions should be achievable. http://github.com/jlongster/autoffi Jeremie wrote a different program which I think used SWIG to parse C code. http://github.com/jlongster/gambit-ffi-generator Pulling out definitions is probably the easiest job for automatic FFI generation. Hopefully you can get something to work from either of these projects. - James
Sorry I did not mean to discredit anyone. I just noticed once before on your site under software autoffi or some such. On Tue, Nov 10, 2009 at 11:01 AM, James Long <longster@gmail.com> wrote:
On Tue, Nov 10, 2009 at 1:48 PM, Pavel Dudrenov <dudrenov@gmail.com> wrote:
I think that James Long was working on some automatic ffi generating code. Maybe you can take a look at his code and see what he is doing and extract things relevant to you. Or just use what he has.
Yeah, I worked on it. So did Jeremie and Christian, and a few others. I wrote "autoffi" which is just a prototype which tries to use SILex to parse C code. This code isn't maintained but hopefully still works. Pulling out definitions should be achievable.
http://github.com/jlongster/autoffi
Jeremie wrote a different program which I think used SWIG to parse C code.
http://github.com/jlongster/gambit-ffi-generator
Pulling out definitions is probably the easiest job for automatic FFI generation. Hopefully you can get something to work from either of these projects.
- James
participants (4)
-
Aditya Godbole -
Alex Queiroz -
James Long -
Pavel Dudrenov