.
D 2000-10-26T00:53:44
J assignee nobody
J cmimetype text/plain
J comment OriginalBugID:\s2119\sBug\nVersion:\s8.1\nSubmitDate:\s'1999-05-21'\nLastModified:\s'1999-05-26'\nSeverity:\sCRIT\nStatus:\sClosed\nSubmitter:\spat\nChangedBy:\sredman\nOS:\sWindows\sNT\nOSVersion:\s4.0sp3\nMachine:\sX86\nFixedDate:\s'2000-10-25'\nFixedInVersion:\sNA\nClosedDate:\s'1999-05-26'\n\n\nName:\nvince\sdarley\n\nReproducibleScript:\nConsider\sa\sC++\sdll\swith\ssome\sglobal\sconstructors\s(i.e.\sconstructors\n\s\s\s\swhich\n\s\s\s\sare\sautomagically\scalled\swhen\sthe\s.dll\sis\sloaded,\sbefore\sthe\s<Pkg>_Init\n\s\s\s\sfunction\sis\scalled).\s\sNow\sif\sthose\sglobal\sconstructors\sactually\scall\n\s\s\s\sTcl,\sfor\sinstance\sif\sa\s'cpp_mem'\sconstuctor\slike\sthe\sfollowing\sis\n\s\s\s\scalled:\n\s\s\s\s\n\s\s\s\scpp_mem(const\schar*\sn=0)\s{\n\s\s\s\sif(n)\s{\n\s\s\s\s_name\s=\sTcl_NewStringObj((char*)n,-1);\n\s\s\s\sTcl_IncrRefCount(_name);\n\s\s\s\s}\n\s\s\s\s}\n\s\s\s\s\n\s\s\s\sNow\sthis\sworks\sfine\swithout\sstubs,\ssince\swe\scan\scall\sTcl_NewStringObj\n\s\s\s\setc\swithout\sknowing\sthe\sTcl\sinterpreter\swhich\sis\sgoing\sto\sbe\sused.\n\s\s\s\sHowever,\swith\sstubs,\ssince\swe\shaven't\syet\scalled\s'Tcl_InitStubs',\n\s\s\s\sTcl_NewStringObj\sis\sobviously\sgoing\sto\sgive\san\saccess\sviolation.\s\sThis\n\s\s\s\smeans\sthe\s.dll\sfails\sto\sload,\sand\sthe\sTcl\s'load'\scommand\sreturns\sthe\n\s\s\s\serror\smessage\s"invalid\sargument".\n\s\s\s\s\n\s\s\s\sThe\ssolution\sto\sthis\sis\sto\s(i)\savoid\scalling\sTcl\sbefore\sthe\s.dll\sis\n\s\s\s\sloaded\s(which\sis\sbackwards\sincompatible,\sand\sremoves\swhat\sI\sfind\sto\sbe\sa\n\s\s\s\suseful\sfeature),\sor\s(ii)\scall\sTcl_InitStubs\searlier.\n\s\s\s\s\n\s\s\s\sI\sview\s(i)\sas\sunacceptable,\sso\slet's\stry\s(ii):\smost\splatforms\sprovide\sa\n\s\s\s\s(compiler/platform\sdependent)\sDll-init\sfunction\swhich\swill\sbe\scalled\n\s\s\s\sbefore\sthe\sglobal\sconstructors\sare,\sso\swe\scan\scall\sTcl_InitStubs\sfrom\n\s\s\s\sthat\s(on\swindows\sit's\sdefined\sas\s'BOOL\sAPIENTRY\sDllEntryPoint(HINSTANCE\n\s\s\s\shInst,\sDWORD\sreason,\sLPVOID\sreserved)',\sand\smust\sbe\sdefined\sby\severy\n\s\s\s\sdll).\s\sUnfortunately,\swe\scan't\scall\sTcl_InitStubs\scorrectly\sfrom\sthat\n\s\s\s\sfunction,\sbecause\swe\sdon't\sknow\sthe\sinterpreter\syet!\s\sIf\swe\stry\sto\scall\n\s\s\s\s'Tcl_InitStubs'\swith\sa\snull\sinterpreter,\sit\sjust\sreturns\san\serror,\ssince\n\s\s\s\sit\sneeds\sto\sget\sa\svalid\sinterpreter\sfrom\swhich\sto\sextract\sthe\sstubs\sptr.\n\s\s\s\s\sI'm\snot\ssure\swhat\sthe\sbest\ssolution\sis!\s\sThere\sought\sto\sbe\ssome\sway\sto\n\s\s\s\sget\sat\sthe\s'default'\sstubs\stable\sif\ssuch\sa\sthing\sexists.\n\s\s\s\s\n\s\s\s\sUnless\sthis\scan\sbe\ssolved,\smy\sC++\sextensions\s(Cpptcl,\sPlcpp,\n\s\s\s\sCppmatrix..)\scannot\suse\sStubs...\n\n\n\nThis\sis\scorrect\sbehavior.\s\sOption\s(i)\sin\shis\sreport\sis\sthe\sonly\sreasonable\sthing\sto\sdo.\n\n--\s05/26/1999\sredman\n\n
J foundin obsolete:\s8.1
J priority 5\sMedium
J resolution None
J status Open
J submitter nobody
J subsystem 69.\sOther
J title conflict\sbetween\sStubs\sand\sC++\sdlls\swith\sglobal\sconstructors
J type Bug
K 218145ffffffffffffffffffffffffffffffffff
U nobody
Z 12f31919b03ff7fd67bad13810586d19