diff options
author | Mike Buland <eichlan@xagasoft.com> | 2006-06-05 20:18:00 +0000 |
---|---|---|
committer | Mike Buland <eichlan@xagasoft.com> | 2006-06-05 20:18:00 +0000 |
commit | 579a58106e541ef4a005eceaf4577048c69fa539 (patch) | |
tree | d90589bd8e3711a042e8f21305549e2c3be2cf0c | |
parent | fa7df2006c0e241314212644c1ec5e362220defd (diff) | |
download | libbu++-579a58106e541ef4a005eceaf4577048c69fa539.tar.gz libbu++-579a58106e541ef4a005eceaf4577048c69fa539.tar.bz2 libbu++-579a58106e541ef4a005eceaf4577048c69fa539.tar.xz libbu++-579a58106e541ef4a005eceaf4577048c69fa539.zip |
Fixes to the plugin system, it's a little tricky to test, but it's looking good.
-rw-r--r-- | src/plugger.h | 6 | ||||
-rw-r--r-- | src/test/plugin/plugin.cpp (renamed from src/plugin.cpp) | 0 | ||||
-rw-r--r-- | src/test/plugin/plugin.h (renamed from src/plugin.h) | 0 | ||||
-rw-r--r-- | tests/guy.cpp | 22 | ||||
-rwxr-xr-x | tests/makeplugin.sh | 3 |
5 files changed, 28 insertions, 3 deletions
diff --git a/src/plugger.h b/src/plugger.h index 2cf224e..5f7df6d 100644 --- a/src/plugger.h +++ b/src/plugger.h | |||
@@ -17,13 +17,13 @@ typedef struct PluginInfo | |||
17 | void (*destroyPlugin)( class Plugin * ); | 17 | void (*destroyPlugin)( class Plugin * ); |
18 | } PluginInfo; | 18 | } PluginInfo; |
19 | 19 | ||
20 | #define PluginInterface( classname, name, ver, rev ) \ | 20 | #define PluginInterface( classname, baseclass, name, ver, rev ) \ |
21 | extern "C" { \ | 21 | extern "C" { \ |
22 | class Plugin *create ##classname() \ | 22 | class baseclass *create ##classname() \ |
23 | { \ | 23 | { \ |
24 | return new classname(); \ | 24 | return new classname(); \ |
25 | } \ | 25 | } \ |
26 | void destroy ##classname( class Plugin *pCls ) \ | 26 | void destroy ##classname( class baseclass *pCls ) \ |
27 | { \ | 27 | { \ |
28 | delete pCls; \ | 28 | delete pCls; \ |
29 | } \ | 29 | } \ |
diff --git a/src/plugin.cpp b/src/test/plugin/plugin.cpp index ea558fd..ea558fd 100644 --- a/src/plugin.cpp +++ b/src/test/plugin/plugin.cpp | |||
diff --git a/src/plugin.h b/src/test/plugin/plugin.h index f726867..f726867 100644 --- a/src/plugin.h +++ b/src/test/plugin/plugin.h | |||
diff --git a/tests/guy.cpp b/tests/guy.cpp new file mode 100644 index 0000000..6510771 --- /dev/null +++ b/tests/guy.cpp | |||
@@ -0,0 +1,22 @@ | |||
1 | #include "stdio.h" | ||
2 | #include "plugin.h" | ||
3 | #include "plugger.h" | ||
4 | |||
5 | class Guy : public Plugin | ||
6 | { | ||
7 | public: | ||
8 | Guy() | ||
9 | { | ||
10 | printf("I'm guy!\n"); | ||
11 | } | ||
12 | |||
13 | virtual ~Guy() | ||
14 | { | ||
15 | printf("Guy is dead...\n"); | ||
16 | } | ||
17 | |||
18 | private: | ||
19 | }; | ||
20 | |||
21 | PluginInterface( Guy, Plugin, "Mike", 0, 1 ) | ||
22 | |||
diff --git a/tests/makeplugin.sh b/tests/makeplugin.sh new file mode 100755 index 0000000..086fefd --- /dev/null +++ b/tests/makeplugin.sh | |||
@@ -0,0 +1,3 @@ | |||
1 | #!/bin/sh | ||
2 | |||
3 | g++ -fPIC -shared -Wl,-soname,guy.so -o guy.so -I../src -I../src/test/plugin guy.cpp ../src/test/plugin/plugin.cpp | ||