From mboxrd@z Thu Jan 1 00:00:00 1970 Path: main.gmane.org!not-for-mail From: Viktor Pavlenko Newsgroups: gmane.lisp.guile.user Subject: Re: how to access subr from scm module? Date: Mon, 18 Nov 2002 20:50:43 -0500 Sender: guile-user-admin@gnu.org Message-ID: <15833.39155.182879.655339@shmyh.ua> References: <15832.2016.640715.722210@shmyh.ua> NNTP-Posting-Host: main.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit X-Trace: main.gmane.org 1037670686 6981 80.91.224.249 (19 Nov 2002 01:51:26 GMT) X-Complaints-To: usenet@main.gmane.org NNTP-Posting-Date: Tue, 19 Nov 2002 01:51:26 +0000 (UTC) Return-path: Original-Received: from monty-python.gnu.org ([199.232.76.173]) by main.gmane.org with esmtp (Exim 3.35 #1 (Debian)) id 18DxXw-0001oS-00 for ; Tue, 19 Nov 2002 02:51:24 +0100 Original-Received: from localhost ([127.0.0.1] helo=monty-python.gnu.org) by monty-python.gnu.org with esmtp (Exim 4.10) id 18DxY5-0005ec-00; Mon, 18 Nov 2002 20:51:33 -0500 Original-Received: from list by monty-python.gnu.org with tmda-scanned (Exim 4.10) id 18DxXQ-0004Ud-00 for guile-user@gnu.org; Mon, 18 Nov 2002 20:50:52 -0500 Original-Received: from mail by monty-python.gnu.org with spam-scanned (Exim 4.10) id 18DxXK-0004Bg-00 for guile-user@gnu.org; Mon, 18 Nov 2002 20:50:48 -0500 Original-Received: from cpe024460001318.cpe.net.cable.rogers.com ([24.156.154.176] helo=shmyh.ua) by monty-python.gnu.org with esmtp (Exim 4.10) id 18DxXJ-00047G-00 for guile-user@gnu.org; Mon, 18 Nov 2002 20:50:45 -0500 Original-Received: by shmyh.ua (Postfix, from userid 502) id 39CFBE5F9; Mon, 18 Nov 2002 20:50:43 -0500 (EST) Original-To: guile-user@gnu.org In-Reply-To: <15832.2016.640715.722210@shmyh.ua> X-Mailer: VM 7.07 under Emacs 21.2.1 Errors-To: guile-user-admin@gnu.org X-BeenThere: guile-user@gnu.org X-Mailman-Version: 2.0.11 Precedence: bulk List-Help: List-Post: List-Subscribe: , List-Id: General Guile related discussions List-Unsubscribe: , List-Archive: Xref: main.gmane.org gmane.lisp.guile.user:1369 X-Report-Spam: http://spam.gmane.org/gmane.lisp.guile.user:1369 >>>>> "VP" == Viktor Pavlenko writes: VP> I would prefer making a SCM module of my C procedures [...] ... and this is how to do it (I'm posting this in hope it may save someone's time). Regards Viktor ------------------------------------------------------------------>8 #include SCM my_proc() { return scm_makfrom0str( "testing" ); } void init( void* ) { SCM proc_scm = scm_c_define_gsubr( "*my-proc*", 0, 0, 0, my_proc ); scm_c_export( "*my-proc*", 0 ); } void inner_main( void*, int argc, char **argv ) { scm_c_define_module( "test-module", init, 0 ); /* using it from C */ scm_c_use_module( "test-module" ); scm_c_lookup( "*my-proc*" ); /* OK */ /* to use it from a scheme module loaded from C code: (use-modules (test-module)) (*my-proc*) */ } int main( int argc, char** argv ) { scm_boot_guile(argc, argv, inner_main, 0); return 0; } ------------------------------------------------------------------>8 _______________________________________________ Guile-user mailing list Guile-user@gnu.org http://mail.gnu.org/mailman/listinfo/guile-user