Listing 1

DL_EXPORT(void) initopenrj(void) 
{
 PyObject  *module;
 module  = Py_InitModule("openrj", openrj_methods);
 if(NULL != module)
 {
   PyObject  *dict = PyModule_GetDict(module);
   PyObject  *ORDER_FIELDS;
   PyObject  *ELIDE_BLANK_RECORDS;
   DatabaseExceptionObject = Py_BuildValue("s", "openrj.error");
   ORDER_FIELDS            = PyInt_FromLong(ORJ_FLAG_ORDERFIELDS);
   ELIDE_BLANK_RECORDS     = PyInt_FromLong(ORJ_FLAG_ELIDEBLANKRECORDS);
   PyDict_SetItemString(dict, "error", DatabaseExceptionObject);
   PyDict_SetItemString(dictionary, "ORDER_FIELDS", ORDER_FIELDS);
   PyDict_SetItemString(dictionary,"ELIDE_BLANK_RECORDS",ELIDE_BLANK_RECORDS);
 }
 if(PyErr_Occurred())
 {
   Py_FatalError("can't initialize openrj module");
 }
}