Difference between revisions of "Plugin"

From Navit's Wiki
Jump to: navigation, search
(highlightning, carting)
(added a small description for starters.)
Line 4: Line 4:
 
This function is called when the plugin gets loaded.
 
This function is called when the plugin gets loaded.
 
Usually it should call an appropriate  
 
Usually it should call an appropriate  
<source lang="c">void plugin_init(void)plugin_register_something_type()</source>
+
<source lang="c">
 +
void plugin_init(void) {
 +
dbg(0, "Enter\n");
 +
plugin_register_something_type();
 +
dbg(0, "Exit\n");
 +
}
 +
</source>
 
function.
 
function.
 +
 +
Onless you know better, start by creating a new folder under /plugin and add it's name to plugin/Makefile.am
 +
Then add Makefile.am and CMakeLists.txt to you plugin directory, so your plugin is built as a module (e.g. libmyplugin.so).
 +
 +
To have the plugin loaded, you need to add it to the <plugins> Object in navit.xml:
 +
<source lang="xml">
 +
<plugin path="$NAVIT_LIBDIR/*/${NAVIT_LIBPREFIX}libmyplugin.so" active="yes"/>
 +
</source>
  
 
[[Category:Development]]
 
[[Category:Development]]

Revision as of 12:29, 30 May 2013

Nearly everything in navit is a plugin. A plugin is a shared library which needs to contain a function

void plugin_init(void)

This function is called when the plugin gets loaded. Usually it should call an appropriate

void plugin_init(void) {
	dbg(0, "Enter\n");
	plugin_register_something_type();
	dbg(0, "Exit\n");
}

function.

Onless you know better, start by creating a new folder under /plugin and add it's name to plugin/Makefile.am Then add Makefile.am and CMakeLists.txt to you plugin directory, so your plugin is built as a module (e.g. libmyplugin.so).

To have the plugin loaded, you need to add it to the <plugins> Object in navit.xml:

	<plugin path="$NAVIT_LIBDIR/*/${NAVIT_LIBPREFIX}libmyplugin.so" active="yes"/>