Project

General

Profile

Basis of a new plugin » History » Revision 3

Revision 2 (iri, 07/01/2011 12:24 AM) → Revision 3/4 (arkeon, 10/14/2011 01:03 PM)

h1. Basis of a new plugin (on MS Windows) 

 All Scol types and functions are defined in the file header "scol.h", we make these features available including this file. 
 <pre> 
 #include <scol.h> 
 </pre> 

 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). 
 <pre> 
 //!Scol machine declaration for MM macros 
 cbmachine ww; 
 </pre> 

 Each plugin needs a function of loading and unloading. These functions are called by the Scol virtual machine, they have a signature set. 
 <pre> 
 /*!  
  * \brief Starting point of the DLL 
  */ 
  extern "C" __declspec (dllexport)  
  int ScolLoadPlugin(mmachine SCOLloadTemplate(mmachine m, cbmachine w) 
  { 
        // Initializing SDK 
 	 SCOLinitplugin(w); 
  
 	 // Get Scol window handle (for message callback) 
 	 HScol = (HWND)SCgetExtra("hscol"); 
 
 	 // Display debug message 
 	 MMechostr(MSKDEBUG,"Loading Template DLL ...\n"); 	
 	 return 0;  
  } 
 
  /*!  
  * \brief Ending point of the DLL 							                
  */ 
  extern "C" __declspec (dllexport) 
  int ScolUnloadPlugin() SCOLfreeTemplate() 
  { 
 	 // Display debug messages 
 	 MMechostr(MSKDEBUG, "Template DLL CLOSED...\n\n" ); 
 	 return 0; 
  } 
 </pre> 

 To add the plugin to the environment Scol must map the name of the functions of loading and unloading in the file "usm.ini" 
 <pre> 
 plugin plugins/template.dll SCOLloadTemplate SCOLfreeTemplate 
 </pre>