unofficial mirror of guile-user@gnu.org 
 help / color / mirror / Atom feed
* on coding a portable R6RS package supporting Guile and its FFI
@ 2013-01-17 10:53 Marco Maggi
  2013-01-27 15:08 ` Ludovic Courtès
  2013-02-05 17:38 ` Andy Wingo
  0 siblings, 2 replies; 12+ messages in thread
From: Marco Maggi @ 2013-01-17 10:53 UTC (permalink / raw)
  To: guile-user

Ciao,

  in my latest package[1] I am using Guile 2.0.7 and its FFI
along with  Mosh Scheme, Racket, Sagittarius  Scheme, Vicare
Scheme, Ypsilon Scheme.  I have the following observations:

* Guile  does  not  come  with  the  very  simple  SRFI  78:
  lightweight testing.  I had to include it[2][3].

* It appears  that there  is no  facility to  handle "output
  arguments" from  C functions; I  mean the cases where  a C
  function accepts  as argument  a pointer to  variable that
  will be  filled with  some computed value.   I am  using a
  WITH-LOCAL-STORAGE[4]  macro  which  is  maybe  ugly,  but
  works.

  Such  arguments are  common, and  represent a  nuisance to
  handle.  Racket has a sophisticated interface, complicated
  to use  when writing adapter code.   Something simpler but
  built in would be useful (this is the sort of thing a user
  does  not want  to think  about: it  should be  an already
  solved problem).

* Whenever  a callout  to C  accepts a  pointer argument:  a
  bytevector argument  is rejected.   Is this not  a useless
  complication?

  One   can    work   around   it   by    explicitly   using
  BYTEVECTOR->POINTER, so everything is ready in Guile.  The
  other  Scheme   implementations  using   a  non-compacting
  garbage collector already support  this feature and I find
  it truly convenient.

* There are no raw memory  getters and setters[5]?  The fact
  that it is  possible to create a wrapping  bytevector is a
  plus for  sure, but I  find it inconvenient to  allocate a
  bytevector  when I  do not  need it  (and raw  getters and
  setters are really small functions).

* The limit of  10 arguments for callouts to  C is annoying.
  It forced me  to exclude some SOFA  functions resulting in
  amputated Guile support.

TIA

[1] <http://github.com/marcomaggi/r6rs-sofa/>
[2] <http://github.com/marcomaggi/r6rs-sofa/tree/master/lib/guile/srfi>
[3] <http://github.com/marcomaggi/vicare/blob/devel/doc/srfi-lightweight-testing.texi>
[4] <http://github.com/marcomaggi/r6rs-sofa/blob/master/lib/sofa/compat.guile.sls>
[5] <http://marcomaggi.github.com/docs/vicare.html/iklib-pointers.html>
-- 
Marco Maggi



^ permalink raw reply	[flat|nested] 12+ messages in thread

end of thread, other threads:[~2013-02-08 15:52 UTC | newest]

Thread overview: 12+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-01-17 10:53 on coding a portable R6RS package supporting Guile and its FFI Marco Maggi
2013-01-27 15:08 ` Ludovic Courtès
2013-01-28  3:00   ` Daniel Hartwig
2013-02-05 17:38 ` Andy Wingo
2013-02-05 19:29   ` Noah Lavine
2013-02-06  8:36     ` Andy Wingo
2013-02-06 13:25       ` Noah Lavine
2013-02-05 22:31   ` Ludovic Courtès
2013-02-06 10:57     ` Andy Wingo
2013-02-08 14:10       ` Ludovic Courtès
2013-02-08 14:37         ` Andy Wingo
2013-02-08 15:52           ` Ludovic Courtès

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).