This is the mail archive of the guile@sourceware.cygnus.com mailing list for the Guile project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Re: Help: modules and -s switch


Ian Grant <Ian.Grant@cl.cam.ac.uk> writes:

> Currently I have a scheme module (database postgres) that looks like this:
> 
> (define-module (guile-user))
> (dynamic-call "init_postgres" (dynamic-link "libpostgres.so"))
> (define-module (database postgres))
> (define-public (other-parts-of-the-interface-written-in-scheme ....
> 
> which only works for interactive sessions.  How can I conditionally execute 
> the '(define-module (guile-user))' appropriately?  Or is there a specific 
> top-level module for non-interactive guile?

Can you use something like this?

    (define-module (database postgres))

    (dynamic-call "init_postgres" (dynamic-link "libpostgres.so"))
    (export primitive1 primitive2 ...)

    (define-public (other-parts-of-the-interface-written-in-scheme ....

It is somewhat tedious to keep the `export' clause up to date, tho.

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]