ldapmodule.c 972 B

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849
  1. /* See http://www.python-ldap.org/ for details.
  2. * $Id: ldapmodule.c,v 1.9 2009/04/17 12:19:09 stroeder Exp $ */
  3. #include "common.h"
  4. #include "version.h"
  5. #include "constants.h"
  6. #include "errors.h"
  7. #include "functions.h"
  8. #include "schema.h"
  9. #include "ldapcontrol.h"
  10. #include "LDAPObject.h"
  11. DL_EXPORT(void) init_ldap(void);
  12. /* dummy module methods */
  13. static PyMethodDef methods[] = {
  14. { NULL, NULL }
  15. };
  16. /* module initialisation */
  17. DL_EXPORT(void)
  18. init_ldap()
  19. {
  20. PyObject *m, *d;
  21. #if defined(MS_WINDOWS) || defined(__CYGWIN__)
  22. LDAP_Type.ob_type = &PyType_Type;
  23. #endif
  24. /* Create the module and add the functions */
  25. m = Py_InitModule("_ldap", methods);
  26. /* Add some symbolic constants to the module */
  27. d = PyModule_GetDict(m);
  28. LDAPinit_version(d);
  29. LDAPinit_constants(d);
  30. LDAPinit_errors(d);
  31. LDAPinit_functions(d);
  32. LDAPinit_schema(d);
  33. LDAPinit_control(d);
  34. /* Check for errors */
  35. if (PyErr_Occurred())
  36. Py_FatalError("can't initialize module _ldap");
  37. }