From dd5ec533e743674a97344177fbc47925c686ba85 Mon Sep 17 00:00:00 2001
From: Thomas Grill <xovo@users.sourceforge.net>
Date: Thu, 12 Jun 2003 13:09:38 +0000
Subject:  ""

svn path=/trunk/; revision=698
---
 externals/grill/flext/source/flbase.h      |  2 +-
 externals/grill/flext/source/fllib.cpp     |  2 +-
 externals/grill/flext/source/flstdc.h      |  3 ++-
 externals/grill/flext/source/flsupport.cpp |  2 +-
 externals/grill/flext/source/flsupport.h   | 15 ++++++++++++++-
 5 files changed, 19 insertions(+), 5 deletions(-)

(limited to 'externals/grill/flext/source')

diff --git a/externals/grill/flext/source/flbase.h b/externals/grill/flext/source/flbase.h
index 4d0dbdc6..4d0541b8 100644
--- a/externals/grill/flext/source/flbase.h
+++ b/externals/grill/flext/source/flbase.h
@@ -221,7 +221,7 @@ class FLEXT_SHARE flext_obj:
 	public:
 
     	//! Creation callback
-		static void __setup__(t_classid) { flext::Setup(); }	
+		static void __setup__(t_classid) { flext::FLEXT_SETUPFUNC(); }	
 
 		/*! \brief This is a temporary holder
 			\warning don't touch it!
diff --git a/externals/grill/flext/source/fllib.cpp b/externals/grill/flext/source/fllib.cpp
index a6d95895..f84968f2 100755
--- a/externals/grill/flext/source/fllib.cpp
+++ b/externals/grill/flext/source/fllib.cpp
@@ -194,7 +194,7 @@ t_class *flext_obj::getClass(t_classid id) { return reinterpret_cast<libclass *>
 
 void flext_obj::lib_init(const char *name,void setupfun(),bool attr)
 {
-    flext::Setup();
+    flext::FLEXT_SETUPFUNC();
 
 #if FLEXT_SYS == FLEXT_SYS_MAX
 	lib_name = MakeSymbol(name);
diff --git a/externals/grill/flext/source/flstdc.h b/externals/grill/flext/source/flstdc.h
index 6c13a9c4..c875ac1e 100644
--- a/externals/grill/flext/source/flstdc.h
+++ b/externals/grill/flext/source/flstdc.h
@@ -207,7 +207,8 @@ typedef t_symbol *t_symptr;
 
 #ifdef _MSC_VER
 	#ifdef FLEXT_SHARED
-        #ifdef FLEXT_DLL
+        // for compiling a shared flext library FLEXT_EXPORTS must be defined
+        #ifdef FLEXT_EXPORTS
 		    #define FLEXT_SHARE __declspec(dllexport)
         #else
 		    #define FLEXT_SHARE __declspec(dllimport)
diff --git a/externals/grill/flext/source/flsupport.cpp b/externals/grill/flext/source/flsupport.cpp
index 20474812..ac501f78 100644
--- a/externals/grill/flext/source/flsupport.cpp
+++ b/externals/grill/flext/source/flsupport.cpp
@@ -32,7 +32,7 @@ const t_symbol *flext::sym_signal = NULL;
 int flext::Version() { return FLEXT_VERSION; }
 const char *flext::VersionStr() { return FLEXT_VERSTR; }
 
-void flext::Setup()
+void flext::FLEXT_SETUPFUNC()
 {
 	static bool issetup = false;
 	if(issetup) 
diff --git a/externals/grill/flext/source/flsupport.h b/externals/grill/flext/source/flsupport.h
index 6a756590..98fbe441 100644
--- a/externals/grill/flext/source/flsupport.h
+++ b/externals/grill/flext/source/flsupport.h
@@ -974,7 +974,20 @@ protected:
 #ifdef __MRC__
 	friend class flext_obj;
 #endif
-	static void Setup();
+
+/*
+        With linux and more than one flext-based external loaded all calls to static 
+        exported functions refer to the first instance loaded!
+        As single- and multi-threaded to different initializations the function names have
+        to be different as well.
+*/
+#ifdef FLEXT_THREADS
+#define FLEXT_SETUPFUNC SetupMulti
+#else
+#define FLEXT_SETUPFUNC SetupSingle
+#endif
+
+	static void FLEXT_SETUPFUNC();
 
 	static bool chktilde(const char *objname);
 
-- 
cgit v1.2.1