This is the mail archive of the guile@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: probably faqs


Matthew Crosby <crosby@nago.cs.colorado.edu> writes:

> Hi!  I just recently started playing with Guile, and I have a couple of 
> questions.  Probably mostly FAQs, but I didn't see anything in any of
> the docs I saw:

Have you checked http://www.red-bean.com/guile/ ?  That's the
canonical homepage, with links to all sorts of contributed software. 

> 1)  I notice guile has native threading (cool).  I take it that it is thread
>     safe, ie I can use a process with multiple pthreads and have some of
>     them use guile?  Anything I should know about?

Unfortunately, guile can't use OS-level threads.  The guile threads
are implemented at a scheme level, and (in 1.2) may not have proper IO
behaviour (ISTR the whole process blocking on IO).  Things are
improved in the developer snapshots, and more fixed are scheduled for
1.3.  OS-level threads are wild-blue-yonder stuff. 

> 2)  Does anyone have any information about C++ interfacing to guile?
>     The fsf web page mentions that "Bill Nell has written a guile/C++ 
>     interface system", but the link from the page doesn't work.  
>     In particular, when I tried a simple app just using the c bindings,
>     I notice that there seems to be some "#ifdef __cplusplus extern C {"
>     missing in the header files, so the compiler is assuming c++ linkage.

Somebody did C++ bindings; I don't remember if they're maintained.  If
the link on red-bean is stale, probably not.  But you can check in the
guile contrib archives. 


>     I suppose I could just build a wrapper file, compile with C and
>     then call that, but that seems a little messy.  (Or, yes, I can
>     just put my own "extern C" in the header files.)
>     Should I check out SWIG?

I don't think SWIG is what you want here.  It's more for wrapping
other libraries as an entry point to Tcl, python, or guile.  It's not
well-designed for scheme, so you might prefer to look at G-wrap. 

> 3)  I've been thinking about using guile as a network interface, ie
>     binding to a port and then passing the socket to guile, so that you can 
>     just telnet in and get the guile interpreter.  Is this feasable?  Has
>     anyone done this?

This is feasible; somebody did it as a demo of how to use threads in
guile.  Look in the mailing list archves (ISTR a thread about
scm_internal_select); it might have made it into a manual, or it might
be in contrib.

Andrew