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