For Programmers: Free Programming Magazines  


Home > Archive > Tcl > April 2005 > Embedding/extending with tclstubs in applications









You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

 

Author Embedding/extending with tclstubs in applications
Sam Fatoohi

2005-04-19, 8:58 pm

Is the tclstub library only there for extending existing tcl
interpreters, or can it be used for embedding tcl in applications? The
main thing I'd like to do would be to use tcl stubs or anything to be
able to load the currently existing dll, because for my application I
will not know which tcl dll is in my local directory at run-time. I
also do not want to statically link with a tcl library because I want
to give the user of my application the ability to dump any tcl dll in
my application's directory and be able to work off of that version of
tcl. However, it appears that I cannot call any Tcl_ commands without
loading a dll and I would like to avoid having to explicitly name the
dll and using LoadLibrary because I don't know exactly which dll is
going to be in my local working directory. I was hoping I could
tclstubs in some way to get this working, but I cannot figure out what
exactly I can do with it. Thanks in advance for your help!

David Gravereaux

2005-04-20, 4:00 am

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Sam Fatoohi wrote:
> Is the tclstub library only there for extending existing tcl
> interpreters, or can it be used for embedding tcl in applications?


You can use it apps, sure.

> The
> main thing I'd like to do would be to use tcl stubs or anything to be
> able to load the currently existing dll, because for my application I
> will not know which tcl dll is in my local directory at run-time.


exactly ;)

> I
> also do not want to statically link with a tcl library because I want
> to give the user of my application the ability to dump any tcl dll in
> my application's directory and be able to work off of that version of
> tcl. However, it appears that I cannot call any Tcl_ commands without
> loading a dll and I would like to avoid having to explicitly name the
> dll and using LoadLibrary because I don't know exactly which dll is
> going to be in my local working directory. I was hoping I could
> tclstubs in some way to get this working, but I cannot figure out what
> exactly I can do with it. Thanks in advance for your help!
>


First off, what O/S? On windows you just use LoadLibrary, grab
Tcl_CreateInterp, call it, then Tcl_InitStub, Tcl_FindExecutable, then either
use or discard that interp.

- From where to LoadLibrary is a bit tricky. ActiveTcl stores its location in
HKEY_LOCAL_MACHINE\SOFTWARE\ActiveState\
ActiveTcl\* . The old Scriptics
installers used HKEY_LOCAL_MACHINE\SOFTWARE\Scriptics\Tc
l\* . A DIY build with
nmake doesn't set any regkey. There is currently no TIP to state any coherence
with this particular problem.


- --
David Gravereaux <davygrvy@pobox.com>
[species:human; planet:earth,milkyway(western spiral arm),alpha sector]

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.0 (MingW32)

iD8DBQFCZZjWlZadkQh/RmERAq38AKCzT5Z014LRIJXHAz0c/OiNIGIXswCgrnJk
89tlPGCcW5+gRwQQTJeXPWE=
=JYFn
-----END PGP SIGNATURE-----
Sam Fatoohi

2005-04-20, 4:00 am

Thank you very much for your reply David. I am using windows and
compiling with MS VC++ 6.0 (soon moving to .NET 2003). Since I don't
have the name of the tcl dll that I'm using (tcl83.dll, tcl84.dll,
etc), I'm assuming I'll have to use a function like the findTcl
function that you've used in previous posts, such as the one in which
you defined a KickStartTcl function. I'll give that a stab and
hopefully it works for me. Thanks again for your help David.

Sponsored Links







Also available: Server administration forum archive | Web Design forum archive | Software forum archive | Hardware reviews archive

Copyright 2008 codecomments.com