Project

General

Profile

Basis of a new plugin » History » Version 3

arkeon, 10/14/2011 01:03 PM

1 2 iri
h1. Basis of a new plugin (on MS Windows)
2 1 arkeon
3
All Scol types and functions are defined in the file header "scol.h", we make these features available including this file.
4
<pre>
5
#include <scol.h>
6
</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
</pre>
13
14
Each plugin needs a function of loading and unloading. These functions are called by the Scol virtual machine, they have a signature set.
15
<pre>
16
/*! 
17
 * \brief Starting point of the DLL
18
 */
19
 extern "C" __declspec (dllexport) 
20 3 arkeon
 int ScolLoadPlugin(mmachine m, cbmachine w)
21 1 arkeon
 {
22
       // Initializing SDK
23
 	SCOLinitplugin(w);
24
  
25
 	// Get Scol window handle (for message callback)
26
 	HScol = (HWND)SCgetExtra("hscol");
27
 
28
 	// Display debug message
29
 	MMechostr(MSKDEBUG,"Loading Template DLL ...\n");	
30
 	return 0; 
31
 }
32
 
33
 /*! 
34
 * \brief Ending point of the DLL							                
35
 */
36
 extern "C" __declspec (dllexport)
37 3 arkeon
 int ScolUnloadPlugin()
38 1 arkeon
 {
39
 	// Display debug messages
40
 	MMechostr(MSKDEBUG, "Template DLL CLOSED...\n\n" );
41
 	return 0;
42
 }
43
</pre>
44
45
To add the plugin to the environment Scol must map the name of the functions of loading and unloading in the file "usm.ini"
46
<pre>
47 3 arkeon
plugin plugins/template.dll
48 1 arkeon
</pre>