From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: cong gu Newsgroups: gmane.lisp.guile.user Subject: dynamic ffi and C struct Date: Sat, 19 May 2012 06:32:07 -0500 Message-ID: NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 X-Trace: dough.gmane.org 1337447176 3252 80.91.229.3 (19 May 2012 17:06:16 GMT) X-Complaints-To: usenet@dough.gmane.org NNTP-Posting-Date: Sat, 19 May 2012 17:06:16 +0000 (UTC) To: guile-user@gnu.org Original-X-From: guile-user-bounces+guile-user=m.gmane.org@gnu.org Sat May 19 19:06:15 2012 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 1SVn6b-0002v5-5M for guile-user@m.gmane.org; Sat, 19 May 2012 19:06:13 +0200 Original-Received: from localhost ([::1]:55329 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1SVn6a-0000DR-GB for guile-user@m.gmane.org; Sat, 19 May 2012 13:06:12 -0400 Original-Received: from eggs.gnu.org ([208.118.235.92]:36603) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1SVhtM-0000t6-C5 for guile-user@gnu.org; Sat, 19 May 2012 07:32:13 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1SVhtK-0003VY-Rp for guile-user@gnu.org; Sat, 19 May 2012 07:32:11 -0400 Original-Received: from mail-ob0-f169.google.com ([209.85.214.169]:53485) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1SVhtK-0003VQ-K7 for guile-user@gnu.org; Sat, 19 May 2012 07:32:10 -0400 Original-Received: by obbwd18 with SMTP id wd18so6698346obb.0 for ; Sat, 19 May 2012 04:32:07 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:date:message-id:subject:from:to:content-type; bh=lxxcCDzyYIizsDS82PHaFeCTA3NoPr1feVFT7HfrqIA=; b=uSrK9ynE/6mxxJHuUmt0MdWTlXA53UusT1u1ZxdJprNjYwKJStD+lm6klCA2bRK9J9 6dc9gIota3YpIqXmxpZGzatMY7+RQsqmy/QBHdGSfBXTYOHuO2sZtZdJLQ5Of5ewVmeE rDyockY7Ls0xR2X3Qo89DYcrNiWC4qOahS9SfK8jj0qdsPiq2ViECuzTSE8wFy+Tc1mK FkejUitqLbuSfmn87/m9BJI0sqA7nUGhq5ESlE6jPK0RdKaUeaPjT3ZHjB3I+8ypuzRM CQj4hmsCEXRix8g62430peHHxegXmyXs0nkk8YzEwuzMzaXD+/z6bgPqcF3+6e13uQMO sUVQ== Original-Received: by 10.182.111.7 with SMTP id ie7mr13251050obb.14.1337427127745; Sat, 19 May 2012 04:32:07 -0700 (PDT) Original-Received: by 10.76.79.161 with HTTP; Sat, 19 May 2012 04:32:07 -0700 (PDT) X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 209.85.214.169 X-Mailman-Approved-At: Sat, 19 May 2012 13:06:09 -0400 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:9466 Archived-At: Hello, Is it possible to use the current dynamic ffi to call a C function whose parameter is a C struct (not a pointer to a C struct) ? I cannot find much about it in the documentation. After a brief look at the source of foreign.c of guile, I found guile actually does some parsing of nested argument list for `pointer->procedure' and generates compound ffi types. But I don't know the right data structure to give when actually calling the foreign function. For example, what should I do for the following function? typedef struct { int dat[2]; } foo_t; int func ( foo_t arg ); -- Cong Gu