ViewVC Help
View File | Revision Log | Show Annotations | Download File
/cvs/deliantra/server/include/plugin.h
(Generate patch)

Comparing deliantra/server/include/plugin.h (file contents):
Revision 1.14 by root, Tue Aug 29 05:03:55 2006 UTC vs.
Revision 1.15 by pippijn, Mon Dec 11 19:46:46 2006 UTC

11#define PLUGIN_H_ 11#define PLUGIN_H_
12 12
13/*****************************************************************************/ 13/*****************************************************************************/
14/* This one does not exist under Win32. */ 14/* This one does not exist under Win32. */
15/*****************************************************************************/ 15/*****************************************************************************/
16#ifndef WIN32
17#include <dlfcn.h> 16#include <dlfcn.h>
18#endif
19 17
20#undef MODULEAPI
21#ifdef WIN32
22#ifdef PYTHON_PLUGIN_EXPORTS
23#define MODULEAPI __declspec(dllexport)
24#else
25#define MODULEAPI __declspec(dllimport)
26#endif
27#else
28#define MODULEAPI 18#define MODULEAPI
29#endif
30 19
31#include <global.h> 20#include <global.h>
32#include <object.h> 21#include <object.h>
33 22
34#ifdef HAVE_TIME_H 23#ifdef HAVE_TIME_H
39 28
40 29
41/*****************************************************************************/ 30/*****************************************************************************/
42/* This one does not exist under Win32. */ 31/* This one does not exist under Win32. */
43/*****************************************************************************/ 32/*****************************************************************************/
44#ifndef WIN32
45#include <dirent.h> 33#include <dirent.h>
46#endif
47 34
48#define NR_EVENTS 42 35#define NR_EVENTS 42
49 36
50#include <stdarg.h> 37#include <stdarg.h>
51 38
67 54
68typedef void* (*f_plug_api) (int* type, ...); 55typedef void* (*f_plug_api) (int* type, ...);
69typedef int (*f_plug_postinit) (void); 56typedef int (*f_plug_postinit) (void);
70typedef int (*f_plug_init)(const char* iversion, f_plug_api gethooksptr); 57typedef int (*f_plug_init)(const char* iversion, f_plug_api gethooksptr);
71 58
72#ifndef WIN32
73#define LIBPTRTYPE void* 59#define LIBPTRTYPE void*
74#else
75#define LIBPTRTYPE HMODULE
76#endif
77 60
78typedef struct _crossfire_plugin 61typedef struct _crossfire_plugin
79{ 62{
80 f_plug_api eventfunc; /* Event Handler function */ 63 f_plug_api eventfunc; /* Event Handler function */
81 f_plug_api propfunc; /* Plugin getProperty function */ 64 f_plug_api propfunc; /* Plugin getProperty function */
89} crossfire_plugin; 72} crossfire_plugin;
90 73
91extern int plugin_number; 74extern int plugin_number;
92extern crossfire_plugin* plugins_list; 75extern crossfire_plugin* plugins_list;
93 76
94#ifdef WIN32
95
96#define plugins_dlopen(fname) LoadLibrary(fname)
97#define plugins_dlclose(lib) FreeLibrary(lib)
98#define plugins_dlsym(lib,name) GetProcAddress(lib,name)
99
100#else /*WIN32 */
101
102#define plugins_dlopen(fname) dlopen(fname,RTLD_NOW|RTLD_GLOBAL) 77#define plugins_dlopen(fname) dlopen(fname,RTLD_NOW|RTLD_GLOBAL)
103#define plugins_dlclose(lib) dlclose(lib) 78#define plugins_dlclose(lib) dlclose(lib)
104#define plugins_dlsym(lib,name) dlsym(lib,name) 79#define plugins_dlsym(lib,name) dlsym(lib,name)
105#define plugins_dlerror() dlerror() 80#define plugins_dlerror() dlerror()
106#endif /* WIN32 */
107 81
108 82
109/* OBJECT-RELATED HOOKS */ 83/* OBJECT-RELATED HOOKS */
110 84
111#define CFAPI_OBJECT_PROP_OB_ABOVE 1 85#define CFAPI_OBJECT_PROP_OB_ABOVE 1

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines