qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Qemu-devel] [PATCH 1/4] Add module infrastructure to QEMU


From: Anthony Liguori
Subject: Re: [Qemu-devel] [PATCH 1/4] Add module infrastructure to QEMU
Date: Mon, 11 May 2009 16:53:44 -0500
User-agent: Thunderbird 2.0.0.21 (X11/20090320)

Jean-Christophe PLAGNIOL-VILLARD wrote:
diff --git a/module.h b/module.h
new file mode 100644
index 0000000..5aa3eaa
--- /dev/null
+++ b/module.h
@@ -0,0 +1,41 @@
+/*
+ * QEMU Module Infrastructure
+ *
+ * Copyright IBM, Corp. 2009
+ *
+ * Authors:
+ *  Anthony Liguori   <address@hidden>
+ *
+ * This work is licensed under the terms of the GNU GPL, version 2.  See
+ * the COPYING file in the top-level directory.
+ *
+ */
+
+#ifndef QEMU_MODULE_H
+#define QEMU_MODULE_H
+
+#define module_init(function, priority)                                  \
+static void __attribute__((constructor)) qemu_init_ ## function(void) {  \
+   register_module_init(function, priority);                             \
+}
+
+#define module_exit(function, priority)                                  \
+static void __attribute__((constructor)) qemu_exit_ ## function(void) {  \
constructor? ;-)

Yes, that's intentional. These functions just register functions, they don't actually call those functions. This allows us to explicitly invoke the constructors/destructors when we want to instead of relying on gcc doing it before and after main.


--
Regards,

Anthony Liguori





reply via email to

[Prev in Thread] Current Thread [Next in Thread]