diff options
| author | 2007-04-29 22:24:38 +0000 | |
|---|---|---|
| committer | 2007-04-29 22:24:38 +0000 | |
| commit | bf7f1fd3c0131c8aa14807dc35aec82b82624823 (patch) | |
| tree | de8ee4aa42be812974772db6e9f3600f72e304b6 /src/modules | |
| parent | added _canunload + more doc + small fix (diff) | |
| download | KVIrc-bf7f1fd3c0131c8aa14807dc35aec82b82624823.tar.gz KVIrc-bf7f1fd3c0131c8aa14807dc35aec82b82624823.tar.bz2 KVIrc-bf7f1fd3c0131c8aa14807dc35aec82b82624823.zip | |
updated doc: easyplugins documentation
git-svn-id: https://svn.kvirc.de/svn/trunk/kvirc@543 17fca916-40b9-46aa-a4ea-0a15b648b75c
Diffstat (limited to 'src/modules')
| -rw-r--r-- | src/modules/system/libkvisystem.cpp | 2 | ||||
| -rw-r--r-- | src/modules/system/plugin.cpp | 24 | ||||
| -rw-r--r-- | src/modules/system/plugin.h | 2 |
3 files changed, 11 insertions, 17 deletions
diff --git a/src/modules/system/libkvisystem.cpp b/src/modules/system/libkvisystem.cpp index 2f3351b58..15125fd4e 100644 --- a/src/modules/system/libkvisystem.cpp +++ b/src/modules/system/libkvisystem.cpp @@ -677,7 +677,7 @@ static bool system_kvs_cmd_setenv(KviKvsModuleCommandCall * c) If you give an absolute path KVIrc will load it directly. [br] [br] - You are free to add more parameters, they will be all given to the easyplugin.[br] + You are free to add more parameters, they will be given to the easyplugin.[br] The easyplugin decides how much parameters you need in addition to the first 2. [br] [br] diff --git a/src/modules/system/plugin.cpp b/src/modules/system/plugin.cpp index c3eccbcee..9aeb1b615 100644 --- a/src/modules/system/plugin.cpp +++ b/src/modules/system/plugin.cpp @@ -45,15 +45,11 @@ @short: Small plugins which can be called in scripts @body: - Where to put Easyplugins? - localdir + "easyplugins/"[br] - globaldir + "easyplugins/"[br][br] - How to call functions of easyplugins:[br] - See: $system.call()[br] - [br] - TODO - [b]exported functions by plugin[/b][br] - [br]_free function (needed)[br] + If you want to know how to call easyplugins please have a look at: $system.call()[br] + This part of the documentation handles only the way how to write an easyplugin. An easyplugin is simply a dll/so. You can create one like you normally make such so/dll files. The important thing is that these so/dll-files export some of the following functions. + [br][br] + [b]Exported functions by easyplugin (C/C++-Examples):[/b][br] + [br][b]_free function[/b] [i] (needed)[/i][br] This function is important! Since KVIrc can not free directly the memory of the dll, the plugins need the _free function so that the memory can be freed by the plugin to prevent memory-leaks.[br] [example] int _free(void * p)[br] @@ -64,7 +60,7 @@ }[br] [/example] - [br]_load function (optional)[br] + [br][b]_load function[/b] [i](optional)[/i][br] After the plugin has be loaded, KVIrc will call the _load-function. Here you can prepare your plugin stuff. [example] int _load()[br] @@ -73,7 +69,7 @@ }[br] [/example] - [br]_unload function (optional)[br] + [br][b]_unload function[/b] [i]((optional)[/i][br] This function will be called before the plugins is unloaded. In this function you can clean up memory or other things. After this call there is no guarantee that the plugin will be kept in memory.[br] [example] @@ -83,18 +79,18 @@ }[br] [/example] - [br]_canunload function (optional)[br] + [br][b]_canunload function[/b] [i](optional)[/i][br] The _canunload-function will be called by KVIrc to check if it may unload the plugin. If return value is true KVIrc will unload the plugin, false means he will try unloading it at the next check.[br] Important: KVIrc will ignore this if unload of plugins will be forced! So you have to be sure that the _unload function of your plugins cleans up![br] [example] - int _canunload(void * p)[br] + int _canunload()[br] {[br] return 0; [br] }[br] [/example] - [br]user function[br] + [br][b]user function[/b][br] This is the general structure of a user function call.[br] The important thing here is the handling of return values. To return a value to KVIrc you have to allocate memory and write the pointer to it into pBuffer. Have a look at the example for more details.[br] [example] diff --git a/src/modules/system/plugin.h b/src/modules/system/plugin.h index c94ebb013..8e7f936af 100644 --- a/src/modules/system/plugin.h +++ b/src/modules/system/plugin.h @@ -27,8 +27,6 @@ #include "kvi_module.h" #include "kvi_dict.h" -#define MAX_RETURN_BUFFER 512 - typedef int (*plugin_function)(int argc, char* argv[], char ** buffer); typedef int (*plugin_unload)(); typedef int (*plugin_canunload)(); |
