summaryrefslogtreecommitdiff
path: root/src/common/plugins.h
diff options
context:
space:
mode:
authorValaris <Valaris@54d463be-8e91-2dee-dedb-b68131a5f0ec>2006-01-29 16:10:48 +0000
committerValaris <Valaris@54d463be-8e91-2dee-dedb-b68131a5f0ec>2006-01-29 16:10:48 +0000
commit620e60eebce2c1f35c5c9a82f6ca365b316587f5 (patch)
tree38a39e0415f419d9a49ae456ed0e26654c23d559 /src/common/plugins.h
parenta2675f07d7da22a7c6ae11f545bf8f671e785a82 (diff)
downloadhercules-620e60eebce2c1f35c5c9a82f6ca365b316587f5.tar.gz
hercules-620e60eebce2c1f35c5c9a82f6ca365b316587f5.tar.bz2
hercules-620e60eebce2c1f35c5c9a82f6ca365b316587f5.tar.xz
hercules-620e60eebce2c1f35c5c9a82f6ca365b316587f5.zip
AS OF SVN REV. 5901, WE ARE NOW USING TRUNK. ALL UNTESTED BUGFIXES/FEATURES GO INTO TRUNK.
IF YOU HAVE A WORKING AND TESTED BUGFIX PUT IT INTO STABLE AS WELL AS TRUNK. EVERYTHING ELSE GOES INTO TRUNK AND WILL BE MERGED INTO STABLE BY VALARIS AND WIZPUTER. -- VALARIS git-svn-id: https://rathena.svn.sourceforge.net/svnroot/rathena/trunk@5094 54d463be-8e91-2dee-dedb-b68131a5f0ec
Diffstat (limited to 'src/common/plugins.h')
-rw-r--r--src/common/plugins.h61
1 files changed, 61 insertions, 0 deletions
diff --git a/src/common/plugins.h b/src/common/plugins.h
new file mode 100644
index 000000000..d642b5965
--- /dev/null
+++ b/src/common/plugins.h
@@ -0,0 +1,61 @@
+// Copyright (c) Athena Dev Teams - Licensed under GNU GPL
+// For more information, see LICENCE in the main folder
+
+#ifndef _PLUGINS_H_
+#define _PLUGINS_H_
+
+////// Dynamic Link Library functions ///////////////
+
+#ifdef _WIN32
+
+ #include <windows.h>
+ #define DLL_OPEN(x) LoadLibrary(x)
+ #define DLL_SYM(x,y,z) (FARPROC)(x) = GetProcAddress(y,z)
+ #define DLL_CLOSE(x) FreeLibrary(x)
+ #define DLL_EXT ".dll"
+ #define DLL HINSTANCE
+ char *DLL_ERROR(void);
+
+#else
+
+ #include <dlfcn.h>
+ #define DLL_OPEN(x) dlopen(x,RTLD_NOW)
+ #define DLL_SYM(x,y,z) (x) = (void *)dlsym(y,z)
+ #define DLL_CLOSE(x) dlclose(x)
+ #define DLL_ERROR dlerror
+
+ #ifdef CYGWIN
+ #define DLL_EXT ".dll"
+ #else
+ #define DLL_EXT ".so"
+ #endif
+ #define DLL void *
+
+#endif
+
+////// Plugin Definitions ///////////////////
+
+typedef struct _Plugin {
+ DLL dll;
+ char state;
+ char *filename;
+ struct _Plugin_Info *info;
+ struct _Plugin *next;
+} Plugin;
+
+/////////////////////////////////////////////
+
+int register_plugin_func (char *);
+int register_plugin_event (void (*)(void), char *);
+int plugin_event_trigger (char *);
+
+int export_symbol (void *, int);
+#define EXPORT_SYMBOL(s) export_symbol((s), -1);
+
+Plugin *plugin_open (const char *);
+void plugin_load (const char *);
+void plugin_unload (Plugin *);
+void plugins_init (void);
+void plugins_final (void);
+
+#endif // _PLUGINS_H_