summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorjan.nijtmans <nijtmans@users.sourceforge.net>2012-12-07 15:51:25 (GMT)
committerjan.nijtmans <nijtmans@users.sourceforge.net>2012-12-07 15:51:25 (GMT)
commitfa2a03a1bf7c810f5d6fb14da98de6d4526339af (patch)
treed685b63a0170957212885561f6386d7189ffad42
parent99bda89c0b6500e673ecacd280527492c780b562 (diff)
downloadtcl-fa2a03a1bf7c810f5d6fb14da98de6d4526339af.zip
tcl-fa2a03a1bf7c810f5d6fb14da98de6d4526339af.tar.gz
tcl-fa2a03a1bf7c810f5d6fb14da98de6d4526339af.tar.bz2
add proper runtime-detection to pkgb.so
-rw-r--r--unix/dltest/pkgb.c11
1 files changed, 10 insertions, 1 deletions
diff --git a/unix/dltest/pkgb.c b/unix/dltest/pkgb.c
index 9c199ca..1a362ef 100644
--- a/unix/dltest/pkgb.c
+++ b/unix/dltest/pkgb.c
@@ -98,6 +98,11 @@ Pkgb_UnsafeObjCmd(
return Tcl_EvalEx(interp, "list unsafe command invoked", -1, TCL_EVAL_GLOBAL);
}
+#if (TCL_MAJOR_VERSION > 8)
+# define Tcl_GetDefaultEncodingDir ((const char *(*)(void)) \
+ ((&(tclStubsPtr->tcl_PkgProvideEx))[341]))
+#endif
+
static int
Pkgb_DemoObjCmd(
ClientData dummy, /* Not used. */
@@ -105,7 +110,11 @@ Pkgb_DemoObjCmd(
int objc, /* Number of arguments. */
Tcl_Obj *const objv[]) /* Argument objects. */
{
- const char *foo = Tcl_GetDefaultEncodingDir();
+ if(!Tcl_GetDefaultEncodingDir) {
+ Tcl_SetObjResult(interp, Tcl_NewStringObj("not supported", -1));
+ return TCL_ERROR;
+ }
+ Tcl_SetObjResult(interp, Tcl_NewStringObj(Tcl_GetDefaultEncodingDir(), -1));
return TCL_OK;
}