]> granicus.if.org Git - graphviz/commitdiff
Fixes so that the stupid way Windows handles dll variables works
authorerg <devnull@localhost>
Wed, 30 May 2007 22:28:27 +0000 (22:28 +0000)
committererg <devnull@localhost>
Wed, 30 May 2007 22:28:27 +0000 (22:28 +0000)
using builtins

lib/gvc/dot_builtins.c

index 7a07d7706cdaa9e66894119bf03ee67e66919a1c..042ad1bca7e8afe1398948487733d237d07a3092 100644 (file)
 
 #include "gvplugin.h"
 
-extern gvplugin_library_t *gvplugin_dot_layout_LTX_library;
-extern gvplugin_library_t *gvplugin_neato_layout_LTX_library;
+#if defined(GVDLL) && !defined(ENABLE_LTDL)
+#define extern __declspec(dllimport)
+#endif
+
+extern gvplugin_library_t gvplugin_dot_layout_LTX_library;
+extern gvplugin_library_t gvplugin_neato_layout_LTX_library;
 #ifdef HAVE_LIBGD
-extern gvplugin_library_t *gvplugin_gd_LTX_library;
+extern gvplugin_library_t gvplugin_gd_LTX_library;
 #endif
 #ifdef HAVE_PANGOCAIRO
-extern gvplugin_library_t *gvplugin_pango_LTX_library;
+extern gvplugin_library_t gvplugin_pango_LTX_library;
 #endif
-extern gvplugin_library_t *gvplugin_core_LTX_library;
+extern gvplugin_library_t gvplugin_core_LTX_library;
 
+#if defined(GVDLL) && !defined(ENABLE_LTDL)
+lt_symlist_t lt_preloaded_symbols[] = {
+       { "gvplugin_dot_layout_LTX_library", 0},
+       { "gvplugin_neato_layout_LTX_library", 0},
+#ifdef HAVE_PANGOCAIRO
+       { "gvplugin_pango_LTX_library", 0},
+#endif
+#ifdef HAVE_LIBGD
+       { "gvplugin_gd_LTX_library", 0},
+#endif
+       { "gvplugin_core_LTX_library", 0},
+       { 0, 0 }
+};
+
+static void*
+lt_lookup (const char* name) 
+{
+    void* addr = 0;
+    switch (*(name + 9)) { /* skip "gvplugin_" */
+    case 'c' :
+       addr = &gvplugin_core_LTX_library;
+       break;
+    case 'd' :
+       addr = &gvplugin_dot_layout_LTX_library;
+       break;
+#ifdef HAVE_LIBGD
+    case 'g' :
+       addr = &gvplugin_gd_LTX_library;
+       break;
+#endif
+    case 'n' :
+       addr = &gvplugin_neato_layout_LTX_library;
+       break;
+#ifdef HAVE_PANGOCAIRO
+    case 'p' :
+       addr = &gvplugin_pango_LTX_library;
+       break;
+#endif
+    }
+    return addr;
+}
+
+void
+init_lt_preloaded_symbols()
+{
+    const char* s;
+    int i;
+    for (i = 0; (s = lt_preloaded_symbols[i].name); i++) {
+       lt_preloaded_symbols[0].address = lt_lookup (s);
+    }
+}
+#else
 const lt_symlist_t lt_preloaded_symbols[] = {
        { "gvplugin_dot_layout_LTX_library", (void*)(&gvplugin_dot_layout_LTX_library) },
        { "gvplugin_neato_layout_LTX_library", (void*)(&gvplugin_neato_layout_LTX_library) },
@@ -42,3 +98,4 @@ const lt_symlist_t lt_preloaded_symbols[] = {
        { "gvplugin_core_LTX_library", (void*)(&gvplugin_core_LTX_library) },
        { 0, 0 }
 };
+#endif