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]

Guile to C++ library link.


Greetings to the beGuiled,

My situation is this. I have a largish (64000+ lines of C++) library
of C++ code. The library mostly provides numerical and statistical and
database like functions for environmental modelling. It includes some
LGPL'd code and hence itself will be LGPL'd.

Unlike STL, it is a tree structured rather than forest
structured. Thus all objects inherit from a common base object.

This has been taken to the fairly advanced extent of providing the
degree of object self-knowledge for C++ objects that smalltalk / Actor
objects have. (Yes, I have read that it can't be done, it required
some hairy hacks, but I've basically done it.)

Now bear with me, I'm getting to the Guile bit.

Now whilst working on the human readable database filters part of the
library it occurred to me that with a fillip of extra work I could
create a human and machine readable mapping between every internal C++
object and the outside world. 

Then a rush of blood to the head suggested adding a simple scheme-like
interpreter that gave interpreted access to all the hundreds of juicy
/ high speed methods in the library.

The next thought, and this is my question, how difficult would it be
to tie such a beast directly to Guile?

Glitches I can think of are...
1) Conflicts between C++ new/delete memory management and Guile
garbage collection. Can I attach a finaliser to the Guile version of
the object that calls in the C++ destructor?

2) The library essentially provides a rich new set of intrinsic objects
for Guile, so I would like to add recognition for some these new
beasties at scanner level. eg. Guile scanner recognises SEXP's,
floats, ints, strings, symbols, vectors. I want to add things like
dates, tensors of elements of type X.

How easy would it be to monkey with something that much in the heart
of Guile, ie the scanner?

3) I can get a list about 2900 "Class::methodName( type,type,type...)"
out of the library file using "nm". What is the easiest way of
translating that into calls from Guile?

John Carter                    EMail: ece@dwaf-hri.pwv.gov.za
Telephone : 27-12-808-0374x194 Fax:- 27-12-808-0338
<http://www.geocities.com/SoHo/Cafe/5947> or <http://iwqs.pwv.gov.za>

There is ever only one enemy - And that is the military. 
It matters not on which side they purport to be.