From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: David Pirotte Newsgroups: gmane.lisp.guile.user Subject: Re: Debian guile-1.8 and ttn guile-pg Date: Tue, 27 May 2008 13:17:18 -0300 Organization: Alto Air Services [http://www.altosw.be/aas/] Message-ID: <20080527131718.6ce2f415@altosw.be> References: <20080329135511.68737330@altosw.be> <87k5jkwgvl.fsf@moley.moleskin.org> <20080330123428.5dff9969@altosw.be> <87ej7qqms3.fsf@ambire.localdomain> <87prr7oq3o.fsf@ambire.localdomain> NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="MP_/crwmxsZGPlsPf1gT/oXXlpN" X-Trace: ger.gmane.org 1211905282 10898 80.91.229.12 (27 May 2008 16:21:22 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Tue, 27 May 2008 16:21:22 +0000 (UTC) Cc: guile-user@gnu.org, Sebastian Tennant , Greg Troxel To: Thien-Thi Nguyen Original-X-From: guile-user-bounces+guile-user=m.gmane.org@gnu.org Tue May 27 18:22:02 2008 Return-path: Envelope-to: guile-user@m.gmane.org Original-Received: from lists.gnu.org ([199.232.76.165]) by lo.gmane.org with esmtp (Exim 4.50) id 1K11vm-0007S2-O1 for guile-user@m.gmane.org; Tue, 27 May 2008 18:21:47 +0200 Original-Received: from localhost ([127.0.0.1]:57370 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1K11v1-0002Uk-Bn for guile-user@m.gmane.org; Tue, 27 May 2008 12:20:59 -0400 Original-Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1K11rh-0000jC-6d for guile-user@gnu.org; Tue, 27 May 2008 12:17:33 -0400 Original-Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1K11rg-0000j0-I9 for guile-user@gnu.org; Tue, 27 May 2008 12:17:32 -0400 Original-Received: from [199.232.76.173] (port=57526 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1K11rg-0000iw-Dt for guile-user@gnu.org; Tue, 27 May 2008 12:17:32 -0400 Original-Received: from maximusconfessor.all2all.org ([62.58.108.13]:50690 helo=smtp.all2all.net) by monty-python.gnu.org with esmtp (Exim 4.60) (envelope-from ) id 1K11rg-0001I0-Hy for guile-user@gnu.org; Tue, 27 May 2008 12:17:32 -0400 Original-Received: from localhost (unknown [192.168.0.2]) by smtp.all2all.net (Postfix) with ESMTP id EDF199F119; Tue, 27 May 2008 18:17:30 +0200 (CEST) X-Virus-Scanned: Debian amavisd-new at antivirus.all2all.org Original-Received: from smtp.all2all.net ([192.168.0.1]) by localhost (maximusconfessor.all2all.org [192.168.0.2]) (amavisd-new, port 10024) with ESMTP id zniCfh45Fk7k; Tue, 27 May 2008 18:14:13 +0200 (CEST) Original-Received: from localhost.localdomain (unknown [201.29.167.154]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by smtp.all2all.net (Postfix) with ESMTP id E07489F10B; Tue, 27 May 2008 18:17:21 +0200 (CEST) In-Reply-To: <87prr7oq3o.fsf@ambire.localdomain> X-Mailer: Claws Mail 3.4.0 (GTK+ 2.12.9; i486-pc-linux-gnu) X-detected-kernel: by monty-python.gnu.org: Linux 2.6, seldom 2.4 (older, 4) 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: , Original-Sender: guile-user-bounces+guile-user=m.gmane.org@gnu.org Errors-To: guile-user-bounces+guile-user=m.gmane.org@gnu.org Xref: news.gmane.org gmane.lisp.guile.user:6581 Archived-At: --MP_/crwmxsZGPlsPf1gT/oXXlpN Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Content-Disposition: inline Hi Thien, Symbols need to be exported. Here is [attached] an exemple of the actual guile-pg 0.16-4=20 postgres.scm file from the latest debian package. The exports are done after the load-extension, but I am convinced it=20 could be done in the define-module #:export clause, could it not? David Le Tue, 27 May 2008 15:04:27 +0200, Thien-Thi Nguyen a =C3=A9crit : > =E2=8E=9B=E2=8E=9E Greg Troxel > =E2=8E=9D=E2=8E=A0 Tue, 27 May 2008 08:46:04 -0400 >=20 > > (define-module (database postgres)) > > (load-extension "/ABS/PATH/TO/libpostgres.so.0.0.0" > > "scm_init_database_postgres_module") >=20 > (I presume you are either consing up the path or substituting > it with autoconf.) >=20 > Yes, either way or even both (whatever will work). >=20 > My understanding is slightly fuzzy, but I think that defines > the guile-pg symbols in the (database postgres) module, but > will not necessarily export them. >=20 > OK. >=20 > The 1.4-style module loading seems to do the equivalent of > define-public. >=20 > Yes. >=20 > I did make guile-pg work with a scheme load file as you write > above once, and I also had a number of export statements. >=20 > So in addition to the above, there needs to be `define-public' > for each proc? Can that be phrased as an `#:export' clause in > the `define-module' form (prior to the `load-extension' call)? >=20 > thi >=20 >=20 --MP_/crwmxsZGPlsPf1gT/oXXlpN Content-Type: text/x-scheme; name=postgres.scm Content-Transfer-Encoding: 7bit Content-Disposition: attachment; filename=postgres.scm ;;; postgres.scm --- wrap PostgreSQL libpq ;; Guile-pg - A Guile interface to PostgreSQL ;; Copyright (C) 1999,2000,2002,2003 Free Software Foundation, Inc. ;; ;; This program is free software; you can redistribute it and/or modify ;; it under the terms of the GNU General Public License as published by ;; the Free Software Foundation; either version 2 of the License, or ;; (at your option) any later version. ;; ;; This program is distributed in the hope that it will be useful, ;; but WITHOUT ANY WARRANTY; without even the implied warranty of ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ;; GNU General Public License for more details. ;; ;; You should have received a copy of the GNU General Public License ;; along with this program; if not, write to the Free Software ;; Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA ;; Author: Ian Grant ;; Load the C interface functions (define-module (database postgres)) (cond ;; maybe this is already done ((and (defined? 'pg-guile-pg-loaded) pg-guile-pg-loaded)) ;; use app-module loader if there ((defined? 'make-app-module-loader) ((make-app-module-loader (lambda (name) (car (list `("~A/guile-pg/0.16" ,(assq-ref %guile-build-info 'libdir))))) (lambda (name) `("lib~A" ,name)) (lambda (name) `("init_~A" ,name))) "postgres")) ;; primitive way (else (dynamic-call "init_postgres" (dynamic-link (car (list (format #f "~A/guile-pg/0.16/libpostgres.so" (assq-ref %guile-build-info 'libdir)))))))) (export pg-guile-pg-loaded) ; ugh (export pg-connectdb) (export pg-connection?) (export pg-setdb) (export pg-reset) (export pg-get-client-data) (export pg-set-client-data!) (export pg-exec) (export pg-result?) (export pg-error-message) (export pg-get-db) (export pg-get-user) (export pg-get-pass) (export pg-get-host) (export pg-get-port) (export pg-get-tty) (export pg-get-options) (export pg-get-connection) (export pg-backend-pid) (export pg-result-status) (export pg-ntuples) (export pg-nfields) (export pg-cmdtuples) (export pg-oid-status) (export pg-oid-value) (export pg-fname) (export pg-fnumber) (export pg-ftype) (export pg-fsize) (export pg-getvalue) (export pg-getlength) (export pg-getisnull) (export pg-binary-tuples?) (export pg-fmod) (export pg-guile-pg-version) (export pg-getline) (export pg-putline) (export pg-endcopy) (export pg-trace) (export pg-untrace) (export pg-make-print-options) (export pg-print) (export pg-lo-creat) (export pg-lo-open) (export pg-lo-unlink) (export pg-lo-get-connection) (export pg-lo-get-oid) (export pg-lo-tell) (export pg-lo-seek) (export pg-lo-read) (export pg-lo-import) (export pg-lo-export) (define-public (pg-guile-pg-module-config-stamp) "Mon Feb 25 11:12:05 EST 2008") (define-public (pg-guile-pg-module-version) "0.16") ;; backward compatibility (not documented to encourage ;; usage of symbols in new code) ;; ;; WARNING: these will go away! (define-public PGRES_EMPTY_QUERY 'PGRES_EMPTY_QUERY) (define-public PGRES_COMMAND_OK 'PGRES_COMMAND_OK) (define-public PGRES_TUPLES_OK 'PGRES_TUPLES_OK) (define-public PGRES_COPY_OUT 'PGRES_COPY_OUT) (define-public PGRES_COPY_IN 'PGRES_COPY_IN) (define-public PGRES_BAD_RESPONSE 'PGRES_BAD_RESPONSE) (define-public PGRES_NONFATAL_ERROR 'PGRES_NONFATAL_ERROR) (define-public PGRES_FATAL_ERROR 'PGRES_FATAL_ERROR) ;;; postgres.scm ends here --MP_/crwmxsZGPlsPf1gT/oXXlpN--