chicken-users
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Chicken-users] "Dynamically Loading" non-entry-point code


From: Daniel B. Faken
Subject: Re: [Chicken-users] "Dynamically Loading" non-entry-point code
Date: Tue, 15 Jun 2004 09:53:34 -0400 (EDT)

On Mon, 14 Jun 2004, felix wrote:
> Daniel B. Faken wrote:
> > Hi,
> > 
> >   Is there a way to initialize scheme code compiled into a shared-library 
> > without using entry points?
> > 
> >   Specifically, I am already linking against another shared-library that 
> > uses entry points, so I can't (?) define them again (unless I maybe keep 
> > count of the index..).
> >   I'm trying to do this to avoid having yet another shared-library that I 
> > need to load - I currently have to link to a common C library (GLUT) AND 
> > dynamically-load a scheme binding to that library - but it seems I should 
> > be able to just combine them in one..
> >   I suppose I could put a link from /usr/lib/libglut.so to 
> > ~faken/lib/chicken/lib/scm-glut-binding.so, but that seems a bit odd.  Is 
> > there a way to explicitly call the "initialization function" for a module 
> > that is already loaded?
> > 
> >   (even more specifically, I have a modified version of GLUT and some 
> > functions that this modified version depends on are within my scheme code 
> > (for the convenience of having the EasyFFI parse the functions).  I wish 
> > to allow an app that loads GLUT as a normal shared library to have access 
> > to another, linked-in, entry-point-defining module, but also to bind
> > the symbols relavant for the GLUT library)
> > 
> >   Pardon the confusion here.. I'm just a bit confused.
> > 
> 
> Well, I'm slightly confused, too... ;-)

Sorry..

> basically, you want to access two compiled Scheme files in a C application,
> right? What you can do is compile one of them with `define-external', and
> use the fundamental ##sys#call-host interface.
> But perhaps you can explain the problem a bit simpler, since I have some 
> problems
> understanding what exactly you need.

I think the basic problem is: I want to have scheme bindings within a 
library, but - since the library is already dynamically loaded by the 
linker - I don't want to call (load-library ..) again.
  Normally I could solve this by just having the code within the 'main' 
unit, but I already have another, independent 'main' unit.

Looking at the generated C, it seems I could do this by calling 
C_foobar_toplevel() to initialize the code with respect to the scheme 
runtime, but I'm not sure what values to pass (esp. for the continuation).

(I looked into the ##sys#call-host function, but I'm not sure if this is 
applicable or how to use it..?)

thanks,
Daniel






reply via email to

[Prev in Thread] Current Thread [Next in Thread]