Skip to content
Tcl Source Code Artifact [4f4e0d6337]
Login

Artifact [4f4e0d6337]

Artifact 4f4e0d6337d90ff551cd0f913cbd923d5fe7c637:

Ticket change [4f4e0d6337] - New ticket [3588687fffffffff|3588687fff] <i>Tcl_InitStubs() Broken As Designed</i>. by dgp on 2012-11-20 06:41:17.
D 2012-11-20T06:41:17
J assignee dgp
J cmimetype text/plain
J comment \nA\sstubs-enabled\sextension\sencounters\sTcl\sin\sthree\sdistinct\sways.\n\n1)\sIt\scompiles\sagainst\sa\stcl.h\sfile\sfrom\ssome\srelease\sof\sTcl.\s\sWith\s\n\s\s\s\sUSE_TCL_STUBS\sactive,\sthe\sparticular\stcl.h\sfile\sdetermines\sthe\n\s\s\s\slayout\sof\sthe\sstubs\stable\sthat\sthe\sextension\sis\scompiled\sto\sassume.\n\n2)\sIt\slinks\sagainst\ssome\slibtclstub.a\sfile.\s\sThat\slibtclstub.a\sfile\sin\sturn\n\s\s\s\swas\scompiled\sagainst\ssome\stcl.h\sfile\sand\sfrom\sit\sgot\sa\svalue\sof\n\s\s\s\sTCL_STUBS_MAGIC\scompiled\sinto\sit.\s\sAs\sfar\sas\sI\scan\stell\sthere\sis\n\s\s\s\snothing\sin\splace\sto\smake\ssure\sthat\sthe\stwo\stcl.h\sfiles\sso\sfar\smentioned\n\s\s\s\sare\sthe\ssame\sfile,\sor\sat\sa\sminimum\sdefine\sthe\ssame\sTCL_STUBS_MAGIC\n\s\s\s\svalue.\s\sUntil\snow\sit's\snever\sbeen\san\sissue\ssince\swe've\snever\schanged\n\s\s\s\sthat\svalue.\n\n3)\sThe\sextenson\s[load]s\sinto\ssome\sTcl\sinterp.\s\sThe\sextension\scalls\n\s\s\s\sTcl_InitStubs()\spassing\sin\sthe\sinterp\svalue.\s\sT_IS\spulls\sa\stable\spointer\n\s\s\s\sout\sof\sthe\siPtr->stubTable\sfield\sof\sthat\sinterp\sfor\svetting\sfor\ssuitability.\n\nWhat's\simportant\sis\sthat\sthe\stable\sin\siPtr->stubTable\shas\sa\scompatible\nlayout\sto\sthe\sone\sthat\swas\scompiled\sinto\sthe\sextension.\s\sBut\sthe\nmechanism\sin\splace\scannot\scheck\sthis.\s\sTo\sillustrate\sthis,\sconsider\ncompiling\san\sextension\scontaining\sthe\scall\n\n\s\s\s\sTcl_InitStubs(interp,\s"9.0",\s0);\n\nbut\scompiling\sit\sagainst\sa\sTcl\s8\sheader\sfile,\sso\sall\sof\sit's\sother\scalls\ninto\sthe\sTcl\slibrary\sare\scoded\sbased\son\sthe\sassumptions\sof\sthe\sTcl\s8\nstub\stable\slayout.\n\nNext\simagine\slinking\sthis\sagainst\slibtclstubs9.a\sso\sthat\sthe\sTCL_STUBS_MAGIC\nvalue\sthe\sTcl_InitStubs()\scall\swill\sbe\schecking\swill\sbe\sthe\sone\sfor\sthe\sTcl\s9\stable.\n\nThen\s[load]\sin\sa\sTcl\s9\sinterp.\s\sAll\sof\sTcl_InitStubs()\schecks\swill\spass,\sbut\swe'll\nbe\sleft\swith\san\sextension\scompiled\sto\sTcl\s8\slayout\sexpectations\smaking\suse\nof\sa\sTcl\s9\sstub\stable,\sand\sthat's\sgonna\scrash\shard.\n\nNow,\sif\sthe\sextension\swriter\swould\shave\sjust\sstuck\swith\sthe\srecommended\nconvention\sof\n\n\s\s\s\sTcl_InitStubs(interp,\sTCL_VERSION,\s0)\n\nhe\scould\snot\sget\sin\sthis\strouble.\s\sBut\sthat\sis\sour\sfault\sfor\sgiving\shim\sthat\nknob\sto\stweak\sin\sthe\sfirst\splace.\s\sTcl_InitStubs\sought\snot\shave\na\s"version"\sargument\sfor\sthe\scoder\sto\sget\swrong.\s\s\n\n
J foundin None
J is_private 0
J priority 5\sMedium
J resolution None
J status Open
J submitter dgp
J subsystem 39.\sPackage\sManager
J title Tcl_InitStubs()\sBroken\sAs\sDesigned
J type Bug
K 3588687fffffffffffffffffffffffffffffffff
U dgp
Z 58d258cb77ef5c02ea7521da4d2ffad2