unofficial mirror of guile-devel@gnu.org 
 help / color / mirror / Atom feed
* scm_init_guile when null threads
@ 2006-04-01  5:24 Oleg Parashchenko
  2006-04-01  9:01 ` Neil Jerram
  0 siblings, 1 reply; 5+ messages in thread
From: Oleg Parashchenko @ 2006-04-01  5:24 UTC (permalink / raw)


Hello,

I'm trying to compile a program which uses libguile 1.8.0 under Windows
under MinGW. The program is a plugin which uses scm_init_guile to
initialize Guilde when loaded. Unfortunately, the program doesn't compile
due to undefined reference to scm_init_guile. Looking in the archives, I
found the same issue for FreeBSD. As I understand, the function
scm_init_guile indeed isn't available with null threads.

Are there any workarounds? Quick and dirty temporary fixes are ok.

Thank you.


-- 
Oleg Parashchenko  olpa@ http://xmlhack.ru/  XML news in Russian
http://uucode.com/blog/  Generative Programming, XML, TeX, Scheme



_______________________________________________
Guile-devel mailing list
Guile-devel@gnu.org
http://lists.gnu.org/mailman/listinfo/guile-devel


^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: scm_init_guile when null threads
  2006-04-01  5:24 scm_init_guile when null threads Oleg Parashchenko
@ 2006-04-01  9:01 ` Neil Jerram
  2006-04-02  2:48   ` Oleg Parashchenko
  0 siblings, 1 reply; 5+ messages in thread
From: Neil Jerram @ 2006-04-01  9:01 UTC (permalink / raw)
  Cc: guile-devel

Oleg Parashchenko <olpa@xmlhack.ru> writes:

> Hello,
>
> I'm trying to compile a program which uses libguile 1.8.0 under Windows
> under MinGW. The program is a plugin which uses scm_init_guile to
> initialize Guilde when loaded. Unfortunately, the program doesn't compile
> due to undefined reference to scm_init_guile. Looking in the archives, I
> found the same issue for FreeBSD. As I understand, the function
> scm_init_guile indeed isn't available with null threads.
>
> Are there any workarounds? Quick and dirty temporary fixes are ok.

Could you easily rework the program to use scm_boot_guile or
scm_with_guile instead?

      Neil



_______________________________________________
Guile-devel mailing list
Guile-devel@gnu.org
http://lists.gnu.org/mailman/listinfo/guile-devel


^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: scm_init_guile when null threads
  2006-04-01  9:01 ` Neil Jerram
@ 2006-04-02  2:48   ` Oleg Parashchenko
  2006-04-02  5:50     ` Ken Raeburn
  0 siblings, 1 reply; 5+ messages in thread
From: Oleg Parashchenko @ 2006-04-02  2:48 UTC (permalink / raw)


Hello Nail,

On Sat, 01 Apr 2006 10:01:10 +0100
Neil Jerram <neil@ossau.uklinux.net> wrote:

> Oleg Parashchenko <olpa@xmlhack.ru> writes:
> 
> > Hello,
> >
> > I'm trying to compile a program which uses libguile 1.8.0 under
> > Windows under MinGW. The program is a plugin which uses scm_init_guile
> > to initialize Guilde when loaded. Unfortunately, the program doesn't
> > compile due to undefined reference to scm_init_guile. Looking in the
> > archives, I found the same issue for FreeBSD. As I understand, the
> > function scm_init_guile indeed isn't available with null threads.
> >
> > Are there any workarounds? Quick and dirty temporary fixes are ok.
> 
> Could you easily rework the program to use scm_boot_guile or
> scm_with_guile instead?

No, scm_boot_guile doesn't return, and I can't guess what scm_with_guile
does. But looking at sources, I found the function scm_i_init_guile. This
might be exactly what I need, I'll try later.

> 
>       Neil
> 
> 
> 
> _______________________________________________
> Guile-devel mailing list
> Guile-devel@gnu.org
> http://lists.gnu.org/mailman/listinfo/guile-devel
> 



_______________________________________________
Guile-devel mailing list
Guile-devel@gnu.org
http://lists.gnu.org/mailman/listinfo/guile-devel


^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: scm_init_guile when null threads
  2006-04-02  2:48   ` Oleg Parashchenko
@ 2006-04-02  5:50     ` Ken Raeburn
  2006-04-02 15:29       ` Oleg Parashchenko
  0 siblings, 1 reply; 5+ messages in thread
From: Ken Raeburn @ 2006-04-02  5:50 UTC (permalink / raw)
  Cc: guile-devel

On Apr 1, 2006, at 21:48, Oleg Parashchenko wrote:
> Neil Jerram <neil@ossau.uklinux.net> wrote:
>> Could you easily rework the program to use scm_boot_guile or
>> scm_with_guile instead?
>
> No, scm_boot_guile doesn't return, and I can't guess what  
> scm_with_guile
> does. But looking at sources, I found the function  
> scm_i_init_guile. This
> might be exactly what I need, I'll try later.

You call scm_with_guile, and give it a function to call that  
manipulates Guile objects or calls Guile functions; it causes the  
thread to enter "guile mode", calls the function, leaves "guile mode"  
and returns to the caller.  (You can also pass a pointer to whatever  
associated data you want, so you don't have to make your function  
rely on global variables.)

Since it controls entry and exit to your function, its ability to  
figure out where the "guile part" of the stack of that thread (needed  
for garbage collection) starts is much greater than with  
scm_init_guile.  If you use scm_init_guile, it needs to figure out  
where the thread's stack's base is (yes, this may be easier on some  
platforms when configured for null threads), because under that  
interface, you could pop back up a few stack frames before invoking  
some Guile routines and storing objects into stack slots.  Using  
scm_with_guile, your automatic variables with SCM objects won't get  
stored on the "wrong" side of the stack pointer that scm_with_guile  
has recorded.

Ken


_______________________________________________
Guile-devel mailing list
Guile-devel@gnu.org
http://lists.gnu.org/mailman/listinfo/guile-devel


^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: scm_init_guile when null threads
  2006-04-02  5:50     ` Ken Raeburn
@ 2006-04-02 15:29       ` Oleg Parashchenko
  0 siblings, 0 replies; 5+ messages in thread
From: Oleg Parashchenko @ 2006-04-02 15:29 UTC (permalink / raw)


Hello Ken,

On Sun, 2 Apr 2006 00:50:20 -0500
Ken Raeburn <raeburn@raeburn.org> wrote:

...
> 
> You call scm_with_guile, and give it a function to call that  
> manipulates Guile objects or calls Guile functions; it causes the  
> thread to enter "guile mode", calls the function, leaves "guile mode"  
> and returns to the caller.  (You can also pass a pointer to whatever  
> associated data you want, so you don't have to make your function  
> rely on global variables.)

Thank you for explaining the interface.

> 
> Since it controls entry and exit to your function, its ability to  
> figure out where the "guile part" of the stack of that thread (needed  
> for garbage collection) starts is much greater than with  
> scm_init_guile.  If you use scm_init_guile, it needs to figure out  
> where the thread's stack's base is (yes, this may be easier on some  
> platforms when configured for null threads), because under that  
> interface, you could pop back up a few stack frames before invoking  
> some Guile routines and storing objects into stack slots.  Using  
> scm_with_guile, your automatic variables with SCM objects won't get  
> stored on the "wrong" side of the stack pointer that scm_with_guile  
> has recorded.

I have two questions about scm_with_guile related to initialization and
nesting.

I have impression that before using Guile, one has to initialize Guile
using scm_init_gsubr(), scm_init_procprop() etc, but scm_with_guile
doesn't do it. Am I wrong?

Now about nesting. Let's suppose my program switches to Guile using
scm_with_guile (stack base "A"). Guile runs, at some moments executes
an extension function, and switches back to the program. The code needs
some Guile and calls scm_with_guile again (stack base "B"). The question:
does garbage collector work correctly, not missing the Scheme values
between "A" and "B"?

> 
> Ken

-- 
Oleg Parashchenko  olpa@ http://xmlhack.ru/  XML news in Russian
http://uucode.com/blog/  Generative Programming, XML, TeX, Scheme



_______________________________________________
Guile-devel mailing list
Guile-devel@gnu.org
http://lists.gnu.org/mailman/listinfo/guile-devel


^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2006-04-02 15:29 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2006-04-01  5:24 scm_init_guile when null threads Oleg Parashchenko
2006-04-01  9:01 ` Neil Jerram
2006-04-02  2:48   ` Oleg Parashchenko
2006-04-02  5:50     ` Ken Raeburn
2006-04-02 15:29       ` Oleg Parashchenko

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).