From mboxrd@z Thu Jan 1 00:00:00 1970 Path: main.gmane.org!not-for-mail From: Stephen Compall Newsgroups: gmane.lisp.guile.user Subject: Re: Guile questions Date: 26 Aug 2004 16:39:24 -0500 Sender: guile-user-bounces+guile-user=m.gmane.org@gnu.org Message-ID: References: <3508.67.36.45.214.1093546146.squirrel@67.36.45.214> NNTP-Posting-Host: deer.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: sea.gmane.org 1093557345 14051 80.91.224.253 (26 Aug 2004 21:55:45 GMT) X-Complaints-To: usenet@sea.gmane.org NNTP-Posting-Date: Thu, 26 Aug 2004 21:55:45 +0000 (UTC) Cc: guile-user@gnu.org Original-X-From: guile-user-bounces+guile-user=m.gmane.org@gnu.org Thu Aug 26 23:55:35 2004 Return-path: Original-Received: from lists.gnu.org ([199.232.76.165]) by deer.gmane.org with esmtp (Exim 3.35 #1 (Debian)) id 1C0RyN-0001RH-00 for ; Thu, 26 Aug 2004 23:39:55 +0200 Original-Received: from localhost ([127.0.0.1] helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.33) id 1C0S30-00067d-Iq for guile-user@m.gmane.org; Thu, 26 Aug 2004 17:44:42 -0400 Original-Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.33) id 1C0S2v-000661-Pt for guile-user@gnu.org; Thu, 26 Aug 2004 17:44:37 -0400 Original-Received: from exim by lists.gnu.org with spam-scanned (Exim 4.33) id 1C0S2u-00064t-KL for guile-user@gnu.org; Thu, 26 Aug 2004 17:44:37 -0400 Original-Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.33) id 1C0S2s-00064n-RM for guile-user@gnu.org; Thu, 26 Aug 2004 17:44:36 -0400 Original-Received: from [192.195.228.35] (helo=csserver.evansville.edu) by monty-python.gnu.org with esmtp (TLSv1:DES-CBC3-SHA:168) (Exim 4.34) id 1C0Rxw-0006OG-NQ for guile-user@gnu.org; Thu, 26 Aug 2004 17:39:29 -0400 Original-Received: from csserver.evansville.edu (localhost.localdomain [127.0.0.1]) by csserver.evansville.edu (8.12.11/8.12.11) with ESMTP id i7QLdPNX009093; Thu, 26 Aug 2004 16:39:25 -0500 Original-Received: (from sc87@localhost) by csserver.evansville.edu (8.12.11/8.12.11/Submit) id i7QLdOHB009090; Thu, 26 Aug 2004 16:39:24 -0500 X-Authentication-Warning: csserver.evansville.edu: sc87 set sender to s11@member.fsf.org using -f Original-To: fromfast@rainbarrel.com In-Reply-To: <3508.67.36.45.214.1093546146.squirrel@67.36.45.214> Original-Lines: 78 User-Agent: Gnus/5.09 (Gnus v5.9.0) Emacs/21.3 X-BeenThere: guile-user@gnu.org X-Mailman-Version: 2.1.5 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 Xref: main.gmane.org gmane.lisp.guile.user:3403 X-Report-Spam: http://spam.gmane.org/gmane.lisp.guile.user:3403 "Jim Norris" writes: > Does Guile let you dynamically link to dlls / object library files > at run time without the need for header (*.h) files, *.def files, or > *.lib files? (or the Unix equivalent) You can do this even in C, even fairly portably with libltdl. > If it does, does Guile automatically load the function names into Guile's > namespace at runtime? Do you mean does it find all the so's exported symbols and generate foreign-function interface calls, exporting the results to Scheme? No. The usual manner of making a C library available to Guile is to manually write a wrapper function, though the tools g-wrap and SWIG, which use interface descriptions, are available to generate these wrappers. Here is an example: #include SCM_DEFINE (jim_norris_puts, "jim-norris-puts", 1, 0, 0, (SCM string), "Put @var{string} on FILE* stdout.") #define FUNC_NAME s_jim_norris_puts { SCM_VALIDATE_STRING (SCM_ARG1, string); /* warning -- SCM_STRING_CHARS is deprecated. Plus, one day the chars won't be null-terminated */ fputs (SCM_STRING_CHARS (string), stdout); /* I don't think you have to do this (IIRC Guile waits for all threads to enter the SCM API before GC), but you might someday: */ scm_remember_upto_here_1 (string); return SCM_UNSPECIFIED; } #undef FUNC_NAME void init_jim_norris (void) { #ifndef SCM_MAGIC_SNARFER #include "jim_norris.x" #endif } Then call guile-snarf -o jim_norris.x jim_norris.c, compile to a so, add a module that calls (load-extension "libjimnorris" "init_jim_norris") If it's more complicated, you might create a Scheme module that exports your bindings, then the magic renamery can be done. > If the funtion names autoload, does Guile have a mechanism for > allowing the user to select which dll's functions are in the name > space at any given time? This is in case two dll's have functions > with the same names and to speed up script interpretation. You can control the symbol import how you like, including renaming symbols, and even not importing symbols at all and using @ instead (@ is in HEAD, not 1.6.x). > Are there any features users are asking for that Guile currently > doesn't have? If so is there a need for someone to work on those? If you have a piece of software, consider whether it could benefit from having a powerful extension language built-in, like Guile, and integrate it. -- Stephen Compall or s11 or sirian Sigh. I like to think it's just the Linux people who want to be on the "leading edge" so bad they walk right off the precipice. (Craig E. Groeschel) SWAT ANZUS csystems S Box ASPIC BRLO Taiwan MP5K-SD TELINT AUTODIN jihad argus STARLAN electronic surveillance spies _______________________________________________ Guile-user mailing list Guile-user@gnu.org http://lists.gnu.org/mailman/listinfo/guile-user