On Tue, Dec 10, 2013 at 5:49 AM, Helmut Schaa <helmut.sc...@googlemail.com> wrote: > 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?
There is work going on to port OVS to windows and MSVC is the compiler for that work. I did try out the solution given in the stackoverflow link given. It does compile and the initialize() function gets called before main(). > > 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 _______________________________________________ dev mailing list dev@openvswitch.org http://openvswitch.org/mailman/listinfo/dev