**NRE enabled C commands** ***Rationale*** [HaO] 2014-01-29: (to be removed) I started this page due to lack of information how to handle NRE for commands implemented in C. I would be glad, if this page could be populated by people having more knowledge about the issue. The following information comes from this [https://groups.google.com/forum/#!topic/comp.lang.tcl/eu0_3dpViug%|%clt%|%] communication from [Miguel Sofer] and [DKF]: ***Intro*** I have some commands in a dll which are typically created in the Dllname_Init using: ====== Tcl_CreateObjCommand(Interp, "cmd", cmdProc, NULL, NULL); ====== I want to use them with tcl8.6 and I am thinking if it is wise/necessary to modify them to be NRE enabled. Thus, the upper has to be replaced by: ====== Tcl_NRCreateCommand(Interp, "cmd", cmdProc, cmdNREProc, NULL, NULL); ====== Then there is an example on: [http://wiki.tcl.tk/21771] but I am really lost there. Thus my questions: ***Q1) Is NRE-enableing for C commands a good idea?*** If yes, under which circumstances ? ****Answer by Miguel Sofer**** It is only a good idea if: 1. the command is likely to cause a script (or proc, or lambda, or oo method) evaluation (except via traces, those are "innocuous") 2. you want to allow the evaluated scripts to [yield] If either of those two conditions are not met, you are much better off NOT NRE-enabling your commands - you'd just be paying the cost with zero benefits. Note that 8.6 properly runs all 8.5 C-extensions (assuming they do not use internal headers, in which case it's a "maybe"). ***Q2) Compatibility*** I suppose a NRE enabled dll is not usable with tcl 8.5.x. Is there a way to make a dll working on tcl 8.5 and 8.6 nre enabled ****Answer by Miguel Sofer**** Yes. Compile using stubs against 8.6's tcl.h, and switch at runtime between 8.5 or 8.6 code depending on (for instance) the existence of the command [yield]. ***Q3) Is there a programming example*** I am sorry, the wiki example did not help me understanding what to do. Is there any way. ****Answer by Miguel Sofer**** Plenty of those in the 8.6 sources. I suggest starting with something simple, for instance [catch]. Compare the 8.5 and 8.6 implementations in tclCmdAH.c ***Q4) Is it worthwile to NRE enable Event handler*** Answer moved on [http://wiki.tcl.tk/17195].