From: erg Date: Wed, 30 May 2007 22:28:27 +0000 (+0000) Subject: Fixes so that the stupid way Windows handles dll variables works X-Git-Tag: LAST_LIBGRAPH~32^2~5552 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=b095d7ec4704b557f0819382625fe4df48626462;p=graphviz Fixes so that the stupid way Windows handles dll variables works using builtins --- diff --git a/lib/gvc/dot_builtins.c b/lib/gvc/dot_builtins.c index 7a07d7706..042ad1bca 100644 --- a/lib/gvc/dot_builtins.c +++ b/lib/gvc/dot_builtins.c @@ -20,16 +20,72 @@ #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