From 71201030aedb473d67f15c4ab72ba21c60cca30b Mon Sep 17 00:00:00 2001 From: ai4rei Date: Wed, 29 Dec 2010 05:14:16 +0000 Subject: * Fixed 'console' plugin not working on Windows, due to NULL passed to CreateThread instead of required pointer to thread id variable. - Fixed 'console' plugin causing delete_timer error when it fails to load, due to uninitialized variable. * Renamed plugin.def to sample.def and added 'sample' plugin exports into it, as it's purpose is nothing than a sample right now. - Also added .def files for 'gui' and 'pid' plugins as MSVC does not export everything automatically and missing event export cause the plugins silently failing. - Added VS6, VS8 and VS9 projects for compiling plug-ins, which can be used on Windows. * The plug-in system will now report, if it cannot import an event function. git-svn-id: https://rathena.svn.sourceforge.net/svnroot/rathena/trunk@14638 54d463be-8e91-2dee-dedb-b68131a5f0ec --- src/common/plugins.c | 2 ++ src/login/login.c | 2 +- src/plugins/console.c | 5 +++-- src/plugins/gui.def | 6 ++++++ src/plugins/pid.def | 7 +++++++ src/plugins/plugin.def | 4 ---- src/plugins/sample.def | 11 +++++++++++ 7 files changed, 30 insertions(+), 7 deletions(-) create mode 100644 src/plugins/gui.def create mode 100644 src/plugins/pid.def delete mode 100644 src/plugins/plugin.def create mode 100644 src/plugins/sample.def (limited to 'src') diff --git a/src/common/plugins.c b/src/common/plugins.c index 2d81548a1..2d50fc9e8 100644 --- a/src/common/plugins.c +++ b/src/common/plugins.c @@ -251,6 +251,8 @@ Plugin* plugin_open(const char* filename) func = (Plugin_Event_Func*)DLL_SYM(plugin->dll, events[i].func_name); if (func) register_plugin_event(func, events[i].event_name); + else + ShowError("Failed to locate function '%s' in '%s'.\n", events[i].func_name, filename); } i++; } diff --git a/src/login/login.c b/src/login/login.c index 158ba5150..0876f3fb2 100644 --- a/src/login/login.c +++ b/src/login/login.c @@ -331,7 +331,7 @@ int parse_console(char* buf) sscanf(buf, "%[^\n]", command); - ShowInfo("Console command :%s", command); + ShowInfo("Console command :%s\n", command); if( strcmpi("shutdown", command) == 0 || strcmpi("exit", command) == 0 || diff --git a/src/plugins/console.c b/src/plugins/console.c index 5056eafdc..7ea69c637 100644 --- a/src/plugins/console.c +++ b/src/plugins/console.c @@ -32,7 +32,8 @@ #define WORKER_FUNC_END(name) } ExitThread(0); return 0; } #define WORKER_EXECUTE(name,errvar) \ do{ \ - buf.worker = CreateThread(NULL, 0, worker_ ## name, NULL, CREATE_SUSPENDED, NULL); \ + DWORD dwThreadId; \ + buf.worker = CreateThread(NULL, 0, worker_ ## name, NULL, CREATE_SUSPENDED, &dwThreadId); \ if( errvar ) \ *errvar = ( buf.worker == NULL ); \ }while(0) @@ -135,7 +136,7 @@ unsigned int (*gettick)(void); int (*parse_console)(char* buf); // Locals -int tid; // timer id +int tid = -1; // timer id BUFFER buf; // input buffer WORKER_FUNC_DECLARE(getinput); // worker for the input buffer diff --git a/src/plugins/gui.def b/src/plugins/gui.def new file mode 100644 index 000000000..0a5d6a714 --- /dev/null +++ b/src/plugins/gui.def @@ -0,0 +1,6 @@ +EXPORTS + plugin_info DATA + plugin_event_table DATA + plugin_call_table DATA + + gui_init diff --git a/src/plugins/pid.def b/src/plugins/pid.def new file mode 100644 index 000000000..a70cf8127 --- /dev/null +++ b/src/plugins/pid.def @@ -0,0 +1,7 @@ +EXPORTS + plugin_info DATA + plugin_event_table DATA + plugin_call_table DATA + + pid_create + pid_delete diff --git a/src/plugins/plugin.def b/src/plugins/plugin.def deleted file mode 100644 index 6117bedc6..000000000 --- a/src/plugins/plugin.def +++ /dev/null @@ -1,4 +0,0 @@ -EXPORTS - plugin_info DATA - plugin_event_table DATA - plugin_call_table DATA diff --git a/src/plugins/sample.def b/src/plugins/sample.def new file mode 100644 index 000000000..f5c4af652 --- /dev/null +++ b/src/plugins/sample.def @@ -0,0 +1,11 @@ +EXPORTS + ; common exports + plugin_info DATA + plugin_event_table DATA + plugin_call_table DATA + + ; plugin-specific exports + test_me + do_init + do_final + some_function -- cgit v1.2.3-70-g09d2