[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Chicken-users] Re: SWIG stuff again
From: |
felix winkelmann |
Subject: |
[Chicken-users] Re: SWIG stuff again |
Date: |
Tue, 19 Oct 2004 07:50:59 +0200 |
On Tue, 19 Oct 2004 04:55:39 +0000, John Lenz <address@hidden> wrote:
> On 10/18/04 01:09:48, felix winkelmann wrote:
> > > - This is causing a problem, because the linkage doesn't work for some
> > > reason. The generated chicken code uses C_retrieve2 to get the
> > primitive:
> > > symbol, but it can't be found....
> >
> > How do you link? If you link statically, you will have to pass
> > libchicken last. Are you using csc?
>
> Well actually I tried both ways. The SWIG file Examples/Makefile.in has
> the ability to compile either using csc or also invoking chicken and then
> the compiler. Basicly, I link together the c file resulting from compiling
> example.scm with the example_wrap.cxx file which contains the SWIG
> functions into one dynamic library libexample.so. This one library then
> contains all the code related to the example unit, and is then loaded by
> (load-library) to actually get used.
Do you link in libchicken(.so)?
>
> Well, they are already prefixed by "primitive:" We need to do this anyway
> or we would get symbol conflicts. Say for example there is a low level
> function called "void do_stuff(Foo *f)". We would export a wrapper
> function called "primitive:do_stuff" which would take a chicken swigpointer
> type. We would then export something like this into example.scm
>
> (define-method (do-stuff (f <Foo>))
> (primitive:do-stuff (slot-ref f 'swig-this)))
>
> The idea is that every function that has anything to do with classes will
> be wrapped like this, and any function that only takes "low-level" types
> like "void do_stuff(int a, int b)" will just get exported as
>
> (define do-stuff primitive:do-stuff)
>
> Thus I really would like to just completly hide all the primitive: symbols.
> So I really just need some way in the _wrap.cxx file to provide the
> primitive: symbols only into the example.scm file. Or just some way at the
> end of example.scm to remove the primitive: symbols from the symbol table.
> When running SWIG we know the list of all the primitive: symbols, so it
> would be easy to add something like
> (remove-symbols primitive:do-stuff primitive:whatever)
Hm. That should be possible somehow, I'll check it out.
> >
> > chicken supports passing information back into csc, so it
> > should be quite easy to let SWIG generate code that communicates
> > extra files and/or compile-/link-options to csc. For more
> > specific information, just ask.
>
> I don't really understand what you mean here :) Do you mean that say when
> running csi, it will automatically call csc to compile the code and then
> load it in or something? Or that when chicken encounters a .h file it will
> call swig to parse it somehow?
No, chicken (the compiler) can write certain declarations into
a temporary file, which csc will read and process (provided is
is extended accordingly). If this is not what you need, nevermind.
cheers,
felix