From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Mike Gran Newsgroups: gmane.lisp.guile.user Subject: Re: Using in C a function defined in guile Date: Sun, 6 Sep 2015 16:09:06 +0000 (UTC) Message-ID: <1872887799.61021.1441555746606.JavaMail.yahoo@mail.yahoo.com> References: <20150906141001.GA23312@localhost.localdomain> Reply-To: Mike Gran NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit X-Trace: ger.gmane.org 1441555948 30278 80.91.229.3 (6 Sep 2015 16:12:28 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Sun, 6 Sep 2015 16:12:28 +0000 (UTC) To: Vladimir Zhbanov , "guile-user@gnu.org" Original-X-From: guile-user-bounces+guile-user=m.gmane.org@gnu.org Sun Sep 06 18:12:09 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 1ZYcY3-0005qz-Cn for guile-user@m.gmane.org; Sun, 06 Sep 2015 18:12:07 +0200 Original-Received: from localhost ([::1]:49364 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZYcY3-0004gP-BI for guile-user@m.gmane.org; Sun, 06 Sep 2015 12:12:07 -0400 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:47516) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZYcXu-0004gC-NJ for guile-user@gnu.org; Sun, 06 Sep 2015 12:11:59 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ZYcXr-0001mo-HF for guile-user@gnu.org; Sun, 06 Sep 2015 12:11:58 -0400 Original-Received: from nm36-vm2.bullet.mail.ne1.yahoo.com ([98.138.229.114]:50014) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZYcXr-0001mM-9k for guile-user@gnu.org; Sun, 06 Sep 2015 12:11:55 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=yahoo.com; s=s2048; t=1441555914; bh=szYIu0cb4zwjabA+pk+IorUlKITp8yp5RqTWJKIm4q8=; h=Date:From:Reply-To:To:In-Reply-To:References:Subject:From:Subject; b=n1qDGO4yPZlW9Klv4X/eL7n5e7c5Qgms2xO8eS04t0FXluNV/Wq9QEJDeXbq+OrvJ8mDCzs4VidJJopMjCpmdFLRjQLzEmDMDvDEFXeVarieHnytTx/VGp2tegj5ijBkrrikA6xcWWh1zqKU0/yG7PDYVbTZTjwVVdLnSEz3lEEd0kgTOjMNuMrW7EsCk3G6CPUBme7vAf+4oxZQ8P8PB18GU7h+BYkrR8CI1gBoudPoxTAPAMwfyQ70MjDoYj5j2pf63HKMomyJ036pY3/1xbWbZBPQYIOTsUn5p6JhseK/l+QzXDXGHh0c6uPWEE7RvsBI9szbTRmMynHdJx36xw== Original-Received: from [127.0.0.1] by nm36.bullet.mail.ne1.yahoo.com with NNFMP; 06 Sep 2015 16:11:54 -0000 Original-Received: from [98.138.100.114] by nm36.bullet.mail.ne1.yahoo.com with NNFMP; 06 Sep 2015 16:09:07 -0000 Original-Received: from [98.138.89.240] by tm105.bullet.mail.ne1.yahoo.com with NNFMP; 06 Sep 2015 16:09:07 -0000 Original-Received: from [127.0.0.1] by omp1013.mail.ne1.yahoo.com with NNFMP; 06 Sep 2015 16:09:07 -0000 X-Yahoo-Newman-Property: ymail-4 X-Yahoo-Newman-Id: 441578.49153.bm@omp1013.mail.ne1.yahoo.com X-YMail-OSG: N1yfS7sVM1kQLkiA3j2BFJbTtdM8B_ZD1TuRZDmy8LzzdqJYyouL1P9fIZP7xHh J2zjyhi9Qby83wy3eCHEMZ60mP3m_3KaiIJkvSY_dxxVNLIhkqHHFnhjNZ1grfuBs7.IIOFzG4l8 _qYG.hrI2Fxh.3Yhb56N48J7xgvk3ayJRGuQTlonjUYOfUqyHPpbFr2njoltbBY5GOSWSnceadve UJMWN..GbJkln9bmPGS1F2usiPrdBRNx3EmAE_zNSBKHhH.InKQNCTAwnPSvawgxaTQ3G0edUcJY ZW6q2qFDZQlUAYq6Fy4rXsArkCDUNcaEe2wciJzPczEZy3tNSux89C.kOVqt7dnrzpKoM3mVBwo2 .iRTIn3ToCIJ9_Su3b.NT6OIW6nzJWJGRkHhi54F2u0PmG7kVY9DU_ooui8UN8MCrod_jFdHKxNq OcAtHNqrus3mEzO.M.ExtY.nFHsjnVmEwGYumuFqlnQMyMzkzsOE2idM2I4Ez_flRBsrIMCTlEFV 4aFpH9h0i1X87iIF7 Original-Received: by 98.138.105.193; Sun, 06 Sep 2015 16:09:06 +0000 In-Reply-To: <20150906141001.GA23312@localhost.localdomain> X-detected-operating-system: by eggs.gnu.org: GNU/Linux 3.x X-Received-From: 98.138.229.114 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:11995 Archived-At: On Sunday, September 6, 2015 7:10 AM, Vladimir Zhbanov wrote: > > >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. The simplest way to implement such a thing is using functions like scm_c_eval_string, where one creates a string containing Guile code and executes it. There are more complicated strategies that might be slightly faster. One could get a variable that contains a procedure by using scm_c_public_lookup. Then, the procedure itself can be extracted by using scm_variable_ref. And it can be called using The scm_call_0, scm_call_1 family of functions. There is an example in the manual here http://www.gnu.org/software/guile/manual/html_node/Accessing-Modules-from-C.html -Mike