Functions marked with OVS_CONSTRUCTOR are called unconditionally
before main.

Signed-off-by: Helmut Schaa <helmut.sc...@googlemail.com>
---

This works with gcc (tested), should work with clang (untested)
but does not work with MSVS.

Could anyone using MSVC try if the solution described at
http://stackoverflow.com/questions/1113409/attribute-constructor-equivalent-in-vc
is suitable?

Is MSVC even supported in OVS?

Thanks,
Helmut

 lib/compiler.h | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/lib/compiler.h b/lib/compiler.h
index 0dbacbf..5052ee7 100644
--- a/lib/compiler.h
+++ b/lib/compiler.h
@@ -179,4 +179,8 @@
 #define OVS_PACKED(DECL) __pragma(pack(push, 1)) DECL __pragma(pack(pop))
 #endif
 
+#ifdef __GNUC__
+#define OVS_CONSTRUCTOR(DECL) __attribute__((constructor)) DECL
+#endif
+
 #endif /* compiler.h */
-- 
1.8.1.4

_______________________________________________
dev mailing list
dev@openvswitch.org
http://openvswitch.org/mailman/listinfo/dev

Reply via email to