+VALUE notmuch_rb_cDatabase;
+VALUE notmuch_rb_cDirectory;
+VALUE notmuch_rb_cFileNames;
+VALUE notmuch_rb_cQuery;
+VALUE notmuch_rb_cThreads;
+VALUE notmuch_rb_cThread;
+VALUE notmuch_rb_cMessages;
+VALUE notmuch_rb_cMessage;
+
+VALUE notmuch_rb_eBaseError;
+VALUE notmuch_rb_eDatabaseError;
+VALUE notmuch_rb_eMemoryError;
+VALUE notmuch_rb_eReadOnlyError;
+VALUE notmuch_rb_eXapianError;
+VALUE notmuch_rb_eFileError;
+VALUE notmuch_rb_eFileNotEmailError;
+VALUE notmuch_rb_eNullPointerError;
+VALUE notmuch_rb_eTagTooLongError;
+VALUE notmuch_rb_eUnbalancedFreezeThawError;
+VALUE notmuch_rb_eUnbalancedAtomicError;
+
+ID ID_call;
+ID ID_db_create;
+ID ID_db_mode;
+
+const rb_data_type_t notmuch_rb_object_type = {
+ .wrap_struct_name = "notmuch_object",
+ .function = {
+ .dfree = notmuch_rb_object_free,
+ },
+};
+
+#define define_type(id) \
+ const rb_data_type_t notmuch_rb_ ## id ## _type = { \
+ .wrap_struct_name = "notmuch_" #id, \
+ .parent = ¬much_rb_object_type, \
+ .data = ¬much_ ## id ## _destroy, \
+ .function = { \
+ .dfree = notmuch_rb_object_free, \
+ }, \
+ }
+
+define_type (database);
+define_type (directory);
+define_type (filenames);
+define_type (query);
+define_type (threads);
+define_type (thread);
+define_type (messages);
+define_type (message);
+