[Top][All Lists]

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

Re: [Chicken-users] A more detailed plea for help with FFI...

From: John Lenz
Subject: Re: [Chicken-users] A more detailed plea for help with FFI...
Date: Wed, 15 Dec 2004 19:23:07 +0000

On 12/15/04 07:11:13, Ed Watkeys wrote:

On Dec 15, 2004, at 3:28 AM, Joel Reymont wrote:

Ed Watkeys wrote:

This is something, suprisingly, has been far easier to deal with in
Gambit than in Chicken. In Gambit (4.0b11), I can do something like

Ed, ever considered SWIG?

I have had nothing but success with it in trying to wrap RakNet, GuiChan
and SDL ;-). Some fixes had to be made to SWIG itself but John Lenz (the
Chicken module maintainer) has been fantastic in his support.

Ideally, I would like to be able to use SWIG, but consider the following from the SWIG documentation:

17.8 Unsupported features and known problems
        *       No exception handling.
        *       No director support.
        *       No support for c++ standard types like std::vector.
* No support for automatic garbage collection of wrapped classes and structures. (Planned on adding in SWIG version 1.3.25)
* Importing multiple SWIG modules not working with TinyCLOS. (Planned on fixing for 1.3.25) * Problems with complicated function overloading. (Planned on fixing for 1.3.25)

This is not acceptable to me: I do not want resource management to be the responsibility of my users i.e. Scheme programmers. I don't know when 1.3.25 is coming out and if these fixes are still planned to be in it. That said, I'm going to play with SWIG a bit and see how well it works.

Well, garbage collection should be (relativly) simple to add, now that felix added the C_do_register_finalizer and C_do_unregister_finalizer calls. Do note that SWIG is not the magic bullet in any case, because when writing the SWIG wrapper you need to still tell SWIG about ownership... which functions own which pointers and so forth.

Felix, is C_do_register_finalizer in 1.74 or still just in CVS (or darcs)?

I am also not sure adding it right now to a SWIG release is a great idea, because if I stick them in, SWIG would then require the latest version of chicken... On the other hand, by the time 1.3.25 comes out the version of chicken which includes them should be fine.

As to 1.3.25, it will probably be a longer release cycle of SWIG, so perhaps something like 3 months maybe. BUT, I can actually release a patch against 1.3.24 that would implement garbage collection, since the long release will be due to changes in different languages.

As to interop between chicken eggs and SWIG, I think it might be possible, see that other thread. ("Chicken foreign type to SWIG type")


reply via email to

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