[Metakit] Tcl -> C++ -> Metakit - how to bind to library?

gdedwards at blueyonder.co.uk gdedwards at blueyonder.co.uk
Thu Nov 3 09:14:56 CET 2005


> gdedwards at blueyonder.co.uk wrote:
>
>> I have an application where I want to use Metakit as a persistent
>> object
>> store for some C++ code that happens to be coded as a Tcl
>> extension. The
>> Tcl code itself has no requirements to directly access the Metakit
>> database through mk::whatever calls.
>>
<snip>
> If all you want is MK inside your C++ code, then by all means link to
> the C++ dll or lib.  It's like using any other C/C++ lib inside a
> compiled Tcl extension and simply does not expose MK to Tcl.  IOW, as
> far as Tcl is concerned MK is an implementation detail of your
> extension.
>
> If you do at some point wish to have access from Tcl, you can relink
> to Mk4tcl, which includes the C++ API since it is purely a wrapper
> around it.
>
> Memory management should not be an issue as long as all alloc's (new)
> and free's (delete) are done in the same context.  Don't free an
> object from Tcl if it has been created from C++, and vice-versa.
>
> -jcw

Thank you, Jean-Claude - I'll try the C++ binding route so I can learn a
new way of doing things.

Much appreciated,
Gareth



More information about the Metakit mailing list