TDBC

View Ticket
Login
Ticket Hash: 0a8fd3f25e5ff152bf796f4b3749fe2981d26787
Title: Tdbc_Init() not exported - libtdbc.so not [load]able
Status: Fixed Type: Build_Problem
Severity: Important Priority: Immediate
Subsystem: not_specified Resolution: Fixed
Last Modified: 2012-07-11 22:51:33
Version Found In: 1.0b17
Description:
TDBC fails to build properly on Unices where __attribute__((__visibility__("hidden"))) is supported.

Cause of problem: Tdbc_Init() is defined in tdbc.c with storage class TDBCAPI, which is #defined as MODULE_SCOPE, which is in turn #defined as __attribute__((__visibility__("hidden"))), which means "do not make this symbol visible to dlsym() or ld.so".

That's exactly backwards: extension *_Init routines *must* be visible to dlsym(), so should be declared and defined with storage class DLLEXPORT (not MODULE_SCOPE, not EXTERN, and especially not TCL_STORAGE_CLASS).

<hr /><i>anonymous claiming to be jenglish added on 2012-07-11 21:54:12 UTC:</i><br />
(hope this patch survives fossilization)

--- tdbc.h.broken	2012-07-11 14:13:28.669980232 -0700
+++ tdbc.h	2012-07-11 14:21:15.664986200 -0700
@@ -28,17 +28,7 @@
 #   endif
 #endif
 
-#undef TCL_STORAGE_CLASS
-#ifdef BUILD_tdbc
-#   define TCL_STORAGE_CLASS DLLEXPORT
-#else
-#   define TCL_STORAGE_CLASS
-#endif
-
-EXTERN int		Tdbc_Init(Tcl_Interp *interp);
-
-#undef TCL_STORAGE_CLASS
-#define TCL_STORAGE_CLASS DLLIMPORT
+DLLEXPORT int Tdbc_Init(Tcl_Interp *interp);
 
 /*
  * TDBC_VERSION and TDBC_PATCHLEVEL here must match the ones that
--- tdbc.c.broken	2012-07-11 14:27:13.718553784 -0700
+++ tdbc.c	2012-07-11 14:27:23.367086984 -0700
@@ -191,7 +191,7 @@
  *-----------------------------------------------------------------------------
  */
 
-TDBCAPI int
+DLLEXPORT int
 Tdbc_Init(
     Tcl_Interp* interp		/* Tcl interpreter */
 ) {


<hr /><i>jan.nijtmans added on 2012-07-11 22:51:33 UTC:</i><br />
Should be fixed now