From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: =?UTF-8?Q?Aleix_Conchillo_Flaqu=C3=A9?= Newsgroups: gmane.lisp.guile.devel Subject: Re: ffi for glutInit Date: Thu, 26 Jul 2012 08:46:49 -0700 Message-ID: References: NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 X-Trace: dough.gmane.org 1343317623 18359 80.91.229.3 (26 Jul 2012 15:47:03 GMT) X-Complaints-To: usenet@dough.gmane.org NNTP-Posting-Date: Thu, 26 Jul 2012 15:47:03 +0000 (UTC) Cc: guile-devel To: Nala Ginrut Original-X-From: guile-devel-bounces+guile-devel=m.gmane.org@gnu.org Thu Jul 26 17:47:03 2012 Return-path: Envelope-to: guile-devel@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 1SuQHB-0002i9-Ah for guile-devel@m.gmane.org; Thu, 26 Jul 2012 17:46:57 +0200 Original-Received: from localhost ([::1]:40739 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1SuQHA-0007KW-E2 for guile-devel@m.gmane.org; Thu, 26 Jul 2012 11:46:56 -0400 Original-Received: from eggs.gnu.org ([208.118.235.92]:35928) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1SuQH8-0007KE-5Y for guile-devel@gnu.org; Thu, 26 Jul 2012 11:46:55 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1SuQH4-00022h-14 for guile-devel@gnu.org; Thu, 26 Jul 2012 11:46:54 -0400 Original-Received: from mail-qc0-f169.google.com ([209.85.216.169]:39569) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1SuQH3-00022V-UF for guile-devel@gnu.org; Thu, 26 Jul 2012 11:46:49 -0400 Original-Received: by qcsd16 with SMTP id d16so1466442qcs.0 for ; Thu, 26 Jul 2012 08:46:49 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :cc:content-type; bh=DEfsdweEDvyH05MJWNMfoeJzsTxB/EKlT0UVMKMKEcM=; b=J5HNWz3suKAOpIo7YdlZORKoR6j3f/r49qdAidV660xv1Nc/uaZXRdUTEHu8d7vjug FJDX3y8f9cDWScux/akZgIjTEpBpwbxGh4KHmBL091tyxzXav0jfMKXMN9nCIttuf1Nj LpWszip7JvSV6ZiQDDji74Yv2+nT6F/u3l+DsxCFhv5BXeRCEn8mQU3GU0/YSah1UEVj PYO/f4IoFmtMDlTJ8EAO6s1Xo7HMZbvqcECU83ovQVK3W9fvgjrjM2WAvriaA6TldWxy xfYceRAR4KB+oJyvA/c4XG5Zhlj1lwxM/CpbtSbhEUn5m5Yi2aAD/rQqGgRCHBm+5Wuj m0XQ== Original-Received: by 10.60.3.202 with SMTP id e10mr42766979oee.52.1343317609217; Thu, 26 Jul 2012 08:46:49 -0700 (PDT) Original-Received: by 10.76.97.39 with HTTP; Thu, 26 Jul 2012 08:46:49 -0700 (PDT) In-Reply-To: X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 209.85.216.169 X-BeenThere: guile-devel@gnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: "Developers list for Guile, the GNU extensibility library" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: guile-devel-bounces+guile-devel=m.gmane.org@gnu.org Original-Sender: guile-devel-bounces+guile-devel=m.gmane.org@gnu.org Xref: news.gmane.org gmane.lisp.guile.devel:14757 Archived-At: On Wed, Jul 25, 2012 at 7:30 PM, Nala Ginrut wrote: > hi Aleix! > For our FFI system: > char** <==> '* <==> (quote *) > > I'm not sure I understand your question correctly. > I assume that you want to know what's the presentation of char** for > dynamic-func. > Let me try again: how do I create a C array of strings in scheme? I took define-foreign from guile-gdbm (thanks Ian!): (define libglut (dynamic-link "libglut")) (define-syntax-rule (define-foreign name ret string-name args) (define name (pointer->procedure ret (dynamic-func string-name libglut) args))) Then, for glutInit I already use '* as you suggest: (define-foreign %glutInit void "glutInit" '(list '* '*)) Finally, I implement (glutInit): (define (glutInit) (%glutInit %null-pointer %null-pointer)) Which is obviously not working right now. I need to know how to create char** to be given to %glutInit. I think I know it for the first argument, which is a int* (I'll use a struct with an int and then make-c-struct and then get the pointer). But, how to create char**? I'll probably go into this again in a couple of days, I feel like a truck has ran over me today. Best, Aleix