Skip to content
Snippets Groups Projects
Commit 7cec5211 authored by Jean-François Remacle's avatar Jean-François Remacle
Browse files

*** empty log message ***

parent 022c9550
No related branches found
No related tags found
No related merge requests found
# $Id: Makefile,v 1.12 2001-02-20 18:32:58 geuzaine Exp $ # $Id: Makefile,v 1.13 2001-03-04 22:58:17 remacle Exp $
# #
# Makefile for "libFltk.a" # Makefile for "libFltk.a"
# #
...@@ -12,7 +12,7 @@ RANLIB = ranlib ...@@ -12,7 +12,7 @@ RANLIB = ranlib
LIB = ../lib/libFltk.a LIB = ../lib/libFltk.a
INCLUDE = -I../Common -I../DataStr -I../Graphics -I../Geo\ INCLUDE = -I../Common -I../DataStr -I../Graphics -I../Geo\
-I../Mesh -I../Parser -I../Fltk -I../Mesh -I../Parser -I../Fltk -I../Plugin
C_FLAGS = -g -Wall C_FLAGS = -g -Wall
OS_FLAGS = -D_LITTLE_ENDIAN OS_FLAGS = -D_LITTLE_ENDIAN
......
...@@ -3,11 +3,12 @@ ...@@ -3,11 +3,12 @@
/* /*
Plugin Entry : GMSH_RegisterPlugin Plugin Entry : GMSH_RegisterPlugin
*/ */
extern "C"{
GMSH_Plugin *GMSH_RegisterPlugin () GMSH_Plugin *GMSH_RegisterPlugin ()
{ {
return new GMSH_CutPlanePlugin (1.0,0.0,0.0,0.0); return new GMSH_CutPlanePlugin (1.0,0.0,0.0,0.0);
} }
}
GMSH_CutPlanePlugin::GMSH_CutPlanePlugin(double A, double B, double C, double D) GMSH_CutPlanePlugin::GMSH_CutPlanePlugin(double A, double B, double C, double D)
:a(A),b(B),c(C),d(D) :a(A),b(B),c(C),d(D)
......
# $Id: Makefile,v 1.1 2001-03-04 20:57:49 remacle Exp $ # $Id: Makefile,v 1.2 2001-03-04 22:57:36 remacle Exp $
# #
# Makefile for "libAdapt.a" # Makefile for "libAdapt.a"
# #
...@@ -6,7 +6,7 @@ ...@@ -6,7 +6,7 @@
.IGNORE: .IGNORE:
CC = c++ CC = c++
AR = c++ -shared -o AR = c++ -Wl,--subsystem,windows -shared -o
RM = rm RM = rm
RANLIB = ranlib RANLIB = ranlib
......
...@@ -5,6 +5,8 @@ ...@@ -5,6 +5,8 @@
#include "Message.h" #include "Message.h"
using namespace std; using namespace std;
const char *GMSH_PluginEntry = "GMSH_RegisterPlugin";
#if defined(WIN32) && !defined(__CYGWIN__) #if defined(WIN32) && !defined(__CYGWIN__)
#define SLASH "\\" #define SLASH "\\"
#else #else
...@@ -49,7 +51,6 @@ GMSH_PluginManager* GMSH_PluginManager::Instance() ...@@ -49,7 +51,6 @@ GMSH_PluginManager* GMSH_PluginManager::Instance()
if(!instance) if(!instance)
{ {
instance = new GMSH_PluginManager; instance = new GMSH_PluginManager;
instance->RegisterDefaultPlugins();
} }
return instance; return instance;
} }
...@@ -57,7 +58,8 @@ GMSH_PluginManager* GMSH_PluginManager::Instance() ...@@ -57,7 +58,8 @@ GMSH_PluginManager* GMSH_PluginManager::Instance()
void GMSH_PluginManager::RegisterDefaultPlugins() void GMSH_PluginManager::RegisterDefaultPlugins()
{ {
// For testing // For testing
AddPlugin ("/cygdrive/c/develop/gmsh/Plugin/lib/","libCutPlane");
AddPlugin ("/cygdrive/c/develop/gmsh/Plugin/lib","libCutPlane");
return; return;
char *homeplugins = getenv ("GMSHPLUGINSHOME"); char *homeplugins = getenv ("GMSHPLUGINSHOME");
if(!homeplugins)return; if(!homeplugins)return;
...@@ -72,10 +74,13 @@ void GMSH_PluginManager::AddPlugin( char *dirName, char *pluginName) ...@@ -72,10 +74,13 @@ void GMSH_PluginManager::AddPlugin( char *dirName, char *pluginName)
#else #else
char dynamic_lib[1024]; char dynamic_lib[1024];
char plugin_name[256]; char plugin_name[256];
char plugin_author[256];
char plugin_copyright[256];
char plugin_help[256];
class GMSH_Plugin* (*RegisterPlugin)(void); class GMSH_Plugin* (*RegisterPlugin)(void);
sprintf(dynamic_lib,"%s%s%s.so",dirName,SLASH,pluginName); sprintf(dynamic_lib,"%s%s%s.so",dirName,SLASH,pluginName);
Msg(INFO,"Opening Plugin %s",dynamic_lib); Msg(INFO,"Opening Plugin %s",dynamic_lib);
void *hlib = dlopen (dynamic_lib,RTLD_NOW); void *hlib = dlopen (dynamic_lib,RTLD_LAZY);
char *err = dlerror(); char *err = dlerror();
if(hlib == NULL) if(hlib == NULL)
{ {
...@@ -93,12 +98,17 @@ void GMSH_PluginManager::AddPlugin( char *dirName, char *pluginName) ...@@ -93,12 +98,17 @@ void GMSH_PluginManager::AddPlugin( char *dirName, char *pluginName)
GMSH_Plugin *p = RegisterPlugin(); GMSH_Plugin *p = RegisterPlugin();
p->hlib = hlib; p->hlib = hlib;
p->getName(plugin_name); p->getName(plugin_name);
p->getInfos(plugin_author,plugin_copyright,plugin_help);
if(allPlugins->find(plugin_name) != allPlugins->end()) if(allPlugins->find(plugin_name) != allPlugins->end())
{ {
Msg(WARNING,"Plugin %s Multiply defined",pluginName); Msg(WARNING,"Plugin %s Multiply defined",pluginName);
return; return;
} }
allPlugins->m[plugin_name] = p; allPlugins->m[plugin_name] = p;
Msg(INFO,"Plugin name : %s",plugin_name);
Msg(INFO,"Plugin author : %s",plugin_author);
Msg(INFO,"Plugin copyright : %s",plugin_copyright);
Msg(INFO,"Plugin help : %s",plugin_help);
#endif #endif
} }
......
...@@ -8,7 +8,6 @@ ...@@ -8,7 +8,6 @@
just throw this, the plugin manager will be able to just throw this, the plugin manager will be able to
catch the exception. catch the exception.
*/ */
const char *GMSH_PluginEntry = "GMSH_RegisterPlugin";
class PluginContainer; class PluginContainer;
class Post_View; class Post_View;
...@@ -51,16 +50,16 @@ public: ...@@ -51,16 +50,16 @@ public:
class GMSH_PluginManager class GMSH_PluginManager
{ {
/**
Registering all default plugins that are in $(GMSHPLUGINSHOME)
In fact, we will load all .so files in dir $(GMSHPLUGINSHOME)
*/
void RegisterDefaultPlugins();
GMSH_PluginManager(); GMSH_PluginManager();
~GMSH_PluginManager(); ~GMSH_PluginManager();
static GMSH_PluginManager *instance; static GMSH_PluginManager *instance;
PluginContainer* allPlugins; PluginContainer* allPlugins;
public : public :
/**
Registering all default plugins that are in $(GMSHPLUGINSHOME)
In fact, we will load all .so files in dir $(GMSHPLUGINSHOME)
*/
void RegisterDefaultPlugins();
static GMSH_PluginManager *Instance(); static GMSH_PluginManager *Instance();
/** Dynamically add a plugin pluginName.so in dirName*/ /** Dynamically add a plugin pluginName.so in dirName*/
void AddPlugin(char *dirName, char *pluginName); void AddPlugin(char *dirName, char *pluginName);
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment