Simple Virtual Machine
A simple but flexible virtual machine
SVM plugin configuration

This module contains API functions used to configure a SVM plugin. More...

Functions

SVM_FUNCTION const char * svm_api_get_signature ()
 This function helps the SVM to check the compatibility of a given plugin to its own API. More...
 
SVM_FUNCTION void svm_plugin_configure (void *plugin_handler, const char *plugin_configuration, const char api_signature[], const char svm_version[])
 This function configures a plugin to the virtual machine. More...
 

Detailed Description

This module contains API functions used to configure a SVM plugin.

The configuration of a plugin is done through a dedicated C callback function:

void plugin_configure(void *plugin);

This function can perform some initialisations, but has to call the API function:

void svm_plugin_configure(void *plugin_handler, const char *plugin_configuration, const char api_signature[], const char svm_version[]);
SVM_FUNCTION void svm_plugin_configure(void *plugin_handler, const char *plugin_configuration, const char api_signature[], const char svm_version[])
This function configures a plugin to the virtual machine.

to register all defined objects into the virtual machine.

See also
svm_plugin_configure

Function Documentation

◆ svm_api_get_signature()

SVM_FUNCTION const char * svm_api_get_signature ( )

This function helps the SVM to check the compatibility of a given plugin to its own API.

Any detected incompatibility aborts the boot of the SVM to prevent issues at run time.

Returns
A string containing a hash of the API, computed with the SVM_TYPE* and SVM_FUNCTION macros.

◆ svm_plugin_configure()

SVM_FUNCTION void svm_plugin_configure ( void *  plugin_handler,
const char *  plugin_configuration,
const char  api_signature[],
const char  svm_version[] 
)

This function configures a plugin to the virtual machine.

Parameters
[in]plugin_handlerAn opaque pointer representing a plugin. This pointer is given by the SVM as the first parameter of the plugin_configure function.
[in]plugin_configurationA string representing the dependencies and the definitions of the plugin. Please refer to the SVM man page to have more details about this string syntax.
[in]api_signatureA string representing the SVM API hash used at plugin compilation time. The macro SVM_API_SIGNATURE defined in the <svm/svm_compatibility.h> header should be used here.
[in]svm_versionA string representing the SVM version used at plugin compilation time. The macro SVM_VERSION defined in the <svm/svm_compatibility.h> header should be used here.
Note
This function SHALL be called from the function
void plugin_configure(void *plugin);
defined once in each plugin to declare the plugin content to the SVM. This specific plugin callback will be called at the virtual machine boot time to setup the full virtual machine architecture.

A typical example of a plugin configuration function:

#include <svm/svm_compatibility.h>
...
void plugin_configure(void *plugin)
{
"PLUGIN // put here the plugin name \n"
"USE \n"
... // put here the plugin objects dependencies
"DEFINE \n"
... // put here the objects the plugin promotes
"",
);
}
#define SVM_API_SIGNATURE
Definition: svm_compatibility.h:22
#define SVM_VERSION
Definition: svm_compatibility.h:23