From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: taylanbayirli@gmail.com (Taylan Ulrich =?utf-8?Q?Bay=C4=B1rl=C4=B1?= =?utf-8?Q?=2FKammer?=) Newsgroups: gmane.lisp.guile.user Subject: Re: Using in C a function defined in guile Date: Sun, 06 Sep 2015 16:54:10 +0200 Message-ID: <87a8szbnu5.fsf@T420.taylan> References: <20150906141001.GA23312@localhost.localdomain> NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: text/plain X-Trace: ger.gmane.org 1441551276 26931 80.91.229.3 (6 Sep 2015 14:54:36 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Sun, 6 Sep 2015 14:54:36 +0000 (UTC) To: guile-user@gnu.org Original-X-From: guile-user-bounces+guile-user=m.gmane.org@gnu.org Sun Sep 06 16:54:29 2015 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 1ZYbKn-0004Ha-07 for guile-user@m.gmane.org; Sun, 06 Sep 2015 16:54:21 +0200 Original-Received: from localhost ([::1]:48843 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZYbKn-000693-AN for guile-user@m.gmane.org; Sun, 06 Sep 2015 10:54:21 -0400 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:60479) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZYbKf-00068w-8G for guile-user@gnu.org; Sun, 06 Sep 2015 10:54:14 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ZYbKe-0002dK-5s for guile-user@gnu.org; Sun, 06 Sep 2015 10:54:13 -0400 Original-Received: from mail-wi0-x22d.google.com ([2a00:1450:400c:c05::22d]:33990) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZYbKd-0002ct-VA for guile-user@gnu.org; Sun, 06 Sep 2015 10:54:12 -0400 Original-Received: by wicfx3 with SMTP id fx3so64391629wic.1 for ; Sun, 06 Sep 2015 07:54:11 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=from:to:subject:references:date:in-reply-to:message-id:user-agent :mime-version:content-type; bh=BZt4iXeS0GI7HXbkfgyQgOTiCSr8t64UF+/Sy3qTljc=; b=V1sf9h1SxcrlWil0DVaoHSIJ5nt1VnCatJlzALJ6XhE01diMl0ZLcsQ6saltPp2TaF BClU7Z/71zMYXMBtMvzYSocLwl527cyp8eRMnvRHchdAJ/NZJYC59EU/Pfra4rd7a7hL G4M0vxZvXyV3DHXCvO00hRW0Vl3fylULldUvbs9v6Dkk3kspSoz6TzFvVrerIR94jkt1 wIXzIQLc2vBRFVXmu+8SjzxXKlyzpUu4jjfxUWBBnTW5Ik53kmRJ/saeLfwy+FkYa8yp ak+7tkekSFwNzKhaT17shlLkaB9x3Z54yE9sWArerJ1ikjyx281KKbapFWnnlx/CuLJV Ityg== X-Received: by 10.194.94.165 with SMTP id dd5mr28181628wjb.40.1441551251021; Sun, 06 Sep 2015 07:54:11 -0700 (PDT) Original-Received: from T420.taylan ([2a02:908:c32:4740:221:ccff:fe66:68f0]) by smtp.gmail.com with ESMTPSA id s9sm6987253wiy.1.2015.09.06.07.54.09 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Sun, 06 Sep 2015 07:54:10 -0700 (PDT) In-Reply-To: <20150906141001.GA23312@localhost.localdomain> (Vladimir Zhbanov's message of "Sun, 6 Sep 2015 17:10:01 +0300") User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.5 (gnu/linux) X-detected-operating-system: by eggs.gnu.org: Error: Malformed IPv6 address (bad octet value). X-Received-From: 2a00:1450:400c:c05::22d 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:11993 Archived-At: Vladimir Zhbanov writes: > Hi, guilers. > > After speaking with a man who doesn't like scheme and wants to make all > his work in C, I wonder if there is an easy way to make the procedures > wholly written in Guile available in C, besides any kind of 'eval'. > Looking through the guile info I didn't found anything other. You might want to look into the Dynamic FFI section of the Guile Info manual: (info "(guile) Dynamic FFI") Web version: http://www.gnu.org/software/guile/manual/html_node/Dynamic-FFI.html In summary, you can get pointers to Guile procedures via 'procedure->pointer' ('scm_procedure_to_pointer' in the C API). Working with complicated struct types might be somewhat uncomfortable, and I'm working on https://github.com/taylanub/scheme-bytestructures to solve that, but I haven't worked on integrating it with the FFI much yet. On the meanwhile there's (info "(guile) Foreign Structs"). Web: http://www.gnu.org/software/guile/manual/html_node/Foreign-Structs.html You might also want to go through the rest of the FFI chapter of the manual to see if there's anything useful for you: (info "(guile) Foreign Function Interface") Web: http://www.gnu.org/software/guile/manual/html_node/Foreign-Function-Interface.html > Thanks, > Vladimir That's my limited knowledge. Hope it helps, Taylan