chicken-users
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Chicken-users] How to FFI?


From: Robin Lee Powell
Subject: Re: [Chicken-users] How to FFI?
Date: Tue, 3 Jul 2007 15:09:20 -0700
User-agent: Mutt/1.5.13 (2006-08-11)

On Tue, Jul 03, 2007 at 11:44:02PM +0200, felix winkelmann wrote:
> On 7/3/07, Robin Lee Powell <address@hidden> wrote:
> >
> >I'm looking at using CDK (the widget library for ncurses) for a
> >TUI app (unless anyone else has any better TUI library
> >suggestions? I'd love to hear them).
> >
> >My primary question is, how should I be doing FFI to make it nice
> >and simple for me?
> >
> >http://www.call-with-current-continuation.org/eggs/lazy-ffi.html
> >? http://chicken.wiki.br/dollar ? http://chicken.wiki.br/easyffi
> >?
> >http://chicken.wiki.br/Interface%20to%20external%20functions%20and%20variables
> >?
> 
> Well, it depends... ;-)
> 
> I don't know CDK, so my advice may be completely off the mark.
> Easyffi is (naturally) the easiest way to wrap a large set of
> foreign functionality, with the result that you'll get a C-like
> API in Scheme. You can put higher-level layers on top of it, of
> course. SWIG is also an alternative if you need something
> quick-and-dirty, but usually the fine-tuning of the generated
> bindings can be tedious. 

What's SWIG?

> You normally will also not need a complete wrapper for CDK, if you
> plan to write an application.
> 
> I personally prefer "dollar", but you'll get better type-checking
> with easyffi. lazy-ffi is only useful for C libraries, and the
> direct access to libraries may be fragile.
> 
> Do you need good error-checking? Do you want to access CDK in a
> low-level manner, or would you prefer a complete CDK wrapper? Or
> are you just interested in getting it to work quickly.

I'm actually doing both CDK and libxmmsclient, and I don't need a
compelet wrapper for either of them; I just want things to work, and
I don't mind adding bits of CDK in as I need them.

As a related question, something I ran across in libxmmsclient that
seems particularily tricky: a function with an int return value, but
an int32_t *foo argument where the *actual* data is returned.

In whichever method(s) you reccomend, how would I set up the 32-bit
integer pointer, and then read data out of it after the call?  

-Robin

-- 
http://www.digitalkingdom.org/~rlpowell/ *** http://www.lojban.org/
Reason #237 To Learn Lojban: "Homonyms: Their Grate!"
Proud Supporter of the Singularity Institute - http://singinst.org/




reply via email to

[Prev in Thread] Current Thread [Next in Thread]