Reputation: 3
I have a dll which is linked to tcl static library (tcl84tsx.lib
). Now When it is required , i am dynamicly loading this dll from my exe . My exe calls some functions of dll , and those functions of dll is calling functions of tcl library.
I am getting segmentation fault for any tcl function called from dll.
Following is part of code of dll which first calls Tcl
function:
if (mTclInterp == NULL) {
mTclInterp = Tcl_CreateInterp();
Tcl_Init(mTclInterp);
}
Here i am creating Tcl interpreter
in C++ by calling Tcl_CreatInterp
function of tcl library
. I am getting segmentation
fault at this line. Note that everything is working fine in linux
but i am getting this issue in windows.
Please let me know what i am doing wrong here.
Upvotes: 0
Views: 252
Reputation: 137587
The first call into the Tcl library should be to Tcl_FindExecutable
or to Tcl_Main
(when you want what that does; pretty much the first thing it does inside is call Tcl_FindExecutable
). The call to Tcl_FindExecutable
initialises the library itself, especially in relation to the memory management and filesystem access layers.
Once the library is initialised, you can call the rest of the API, most of which requires an interpreter context handle, so Tcl_CreateInterp
is going to be an early call.
Upvotes: 2