From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Marco Maggi Newsgroups: gmane.lisp.guile.user Subject: on coding a portable R6RS package supporting Guile and its FFI Date: Thu, 17 Jan 2013 11:53:33 +0100 Message-ID: <87y5fsw05u.fsf@rapitore.luna> Reply-To: marco.maggi-ipsu@poste.it NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: text/plain X-Trace: ger.gmane.org 1358435721 28487 80.91.229.3 (17 Jan 2013 15:15:21 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Thu, 17 Jan 2013 15:15:21 +0000 (UTC) To: guile-user@gnu.org Original-X-From: guile-user-bounces+guile-user=m.gmane.org@gnu.org Thu Jan 17 16:15:39 2013 Return-path: Envelope-to: guile-user@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by plane.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1TvrBl-00019t-EU for guile-user@m.gmane.org; Thu, 17 Jan 2013 16:15:33 +0100 Original-Received: from localhost ([::1]:46784 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1TvrBU-0006im-RV for guile-user@m.gmane.org; Thu, 17 Jan 2013 10:15:16 -0500 Original-Received: from eggs.gnu.org ([208.118.235.92]:52331) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1TvrBP-0006hU-Pt for guile-user@gnu.org; Thu, 17 Jan 2013 10:15:12 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Tvn4m-0003tv-Vy for guile-user@gnu.org; Thu, 17 Jan 2013 05:52:06 -0500 Original-Received: from relay-pt2.poste.it ([62.241.5.253]:64734) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Tvn4m-0003tp-OU for guile-user@gnu.org; Thu, 17 Jan 2013 05:52:04 -0500 Original-Received: from rapitore.luna (2.33.217.240) by relay-pt2.poste.it (8.5.142) (authenticated as marco.maggi-ipsu@poste.it) id 50F73F490001B0B1; Thu, 17 Jan 2013 11:51:28 +0100 Original-Sender: marco.maggi-ipsu@poste.it X-Loop: marco@maggi.it.invalid X-Mailer: GNU Emacs Original-Lines: 52 X-detected-operating-system: by eggs.gnu.org: Windows NT kernel [generic] [fuzzy] X-Received-From: 62.241.5.253 X-BeenThere: guile-user@gnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: General Guile related discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: guile-user-bounces+guile-user=m.gmane.org@gnu.org Original-Sender: guile-user-bounces+guile-user=m.gmane.org@gnu.org Xref: news.gmane.org gmane.lisp.guile.user:9877 Archived-At: 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] [2] [3] [4] [5] -- Marco Maggi