Initializing the Engine

The following example shows how to create and initialize a PMX_ENGINE object.

/* Create an engine, have it use "/usr/local/lib/datadir"
* as its datadir */

PMX_ENGINE e;
pmx_load(NULL);
   
if (pmx_create_engine(&e, error, NULL) != PMX_ERR_OK) {
    printf("Could not create PMX_ENGINE instance\n");
    return 1;
}
   
e->vtbl->add_attribute(e, "core.datadir",
    PMX_TYPE_STRING, "/usr/local/lib/datadir", 10, 1);
   
e->vtbl->load_antispam_data();

Description:

  • Initialize the library using pmx_load function
  • Create an instance of the engine using the pmx_create_engine function.
  • Set the core.datadir attribute to indicate the locations of all data files.
  • Load the data file.