-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathplugin.h
28 lines (25 loc) · 796 Bytes
/
plugin.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
#include <stdio.h>
#include <dlfcn.h>
#include <stdbool.h>
/**
* This is a static variable, global to the plugin, to store the interface
* address retrieved from the core. It matches the exported interfaces from the
* core, in order to use the same syntax inside the plugin.
*/
static int *foo;
/**
* Function pointer to the symbol importer in the core. This function returns a
* pointer to the requested symbol/interface. It's automatically initialized
* upon plugin load.
*/
void *(*import_symbol) (void);
/**
* Function that the core will call after the plugin is loaded (this is to
* automate symbol import into the plugin). Relies on import_symbol being
* already set.
*/
bool HPM_shared_symbols(int server_type)
{
foo = (int *)import_symbol();
return foo ? true : false;
}