Custom scoring plugins require an initPlugin function.
initPlugin allows the plugin to load and save configuration information that it will need for scoring. The database connection string and the .ini file name are provided in the configInfo string. initPlugin will be called once for each attribute type that uses a plug-in. These are shared objects. To support plugin use for more than one attribute type, configuration information must be saved for each attribute type. This way when score is called, it can look up the configuration information for the appropriate attribute type.
const int initPlugin(const char *configInfo, const uint configSize, char *errorStr, const uint maxStrSize);
<ERROR>error text</ERROR>
The following is a pseudocode example of a score function:
const int initPlugin(const char *configInfo, const uint configSize, char *errorStr, const uint maxStrSize) { //create string out of configInfo //parse string with XML parser //extract DB_CONNECTION and CONFIG_FILE //connect to database //select config info from database //open CONFIG_FILE //read config info from .ini file //if there was an error create null terminated error string and //strcpy into errorStr. Return -1. //if no error, return 0. }
The initPlugin should return -1 if an error is encountered.