C/XS interfacing with tcl.pm's tcl interpreter dll?

[email protected] (patcat88) Tue, 07 Jun 2011 14:15:31 -0400
Newsgroups perl.tcltk
Message-ID <[email protected]>
I am trying to get access to the C API of the TCL interpreter loaded by 
Tcl.pm in my XS module, on windows. There doesn't seem to be any 
official way to get the final dll path, or HMODULE, of the TCL 
interpreter loaded by Tcl.pm.

My analysis of the situation is that $Tcl::DL_PATH is only a suggestion 
to the XS code, not the final dll name. The XS code checks a few other 
places if $Tcl::DL_PATH failed. From what I understand, Tcl.xs stores 
the dll filename and HMODULE but there is no way to obtain it. I cant 
find any way in TCL the lang, but I know little of it,  to get the 
pathname of the tcl dll, closest I found was "info nameofexecutable" but 
thats perl.exe. There is the TCL C TclWinGetTclInstance to get the 
HMODULE, but you need the function pointer to TclWinGetTclInstance 
first, chicken and egg. Also Tcl.pm doesn't store function pointers in 
SVs, so GetModuleHandleEx is useless.