Project

General

Profile

Basis of a new plugin » History » Version 4

arkeon, 10/24/2014 12:22 AM

1 2 iri
h1. Basis of a new plugin (on MS Windows)
2 1 arkeon
3 4 arkeon
All Scol types and functions are defined in the file header "scolPlugin.h", we make these features available including this file.
4 1 arkeon
<pre>
5 4 arkeon
#include <scolPlugin.h>
6 1 arkeon
</pre>
7
8
To initialize the Scol virtual machine, you must add the following line (the variable must be called absolutely "ww ", the latter being used by all functions of the SDK).
9
<pre>
10
//!Scol machine declaration for MM macros
11
cbmachine ww;
12 4 arkeon
mmachine mm;
13 1 arkeon
</pre>
14
15
Each plugin needs a function of loading and unloading. These functions are called by the Scol virtual machine, they have a signature set.
16
<pre>
17
/*! 
18
 * \brief Starting point of the DLL
19
 */
20
 extern "C" __declspec (dllexport) 
21 3 arkeon
 int ScolLoadPlugin(mmachine m, cbmachine w)
22 1 arkeon
 {
23
       // Initializing SDK
24
 	SCOLinitplugin(w);
25
 
26
 	// Display debug message
27
 	MMechostr(MSKDEBUG,"Loading Template DLL ...\n");	
28
 	return 0; 
29
 }
30
 
31
 /*! 
32
 * \brief Ending point of the DLL							                
33
 */
34
 extern "C" __declspec (dllexport)
35 3 arkeon
 int ScolUnloadPlugin()
36 1 arkeon
 {
37
 	// Display debug messages
38
 	MMechostr(MSKDEBUG, "Template DLL CLOSED...\n\n" );
39
 	return 0;
40
 }
41
</pre>
42
43
To add the plugin to the environment Scol must map the name of the functions of loading and unloading in the file "usm.ini"
44
<pre>
45 3 arkeon
plugin plugins/template.dll
46 1 arkeon
</pre>