Here is some example code:

template <typename T>
struct myclass
{
static void __attribute__((constructor)) do_me_first() { cout <<
"assert" << endl; }
};

So, I want to get the do_me_first method() to run for every version of
this template class that has been created.  Unfortunately, since I
never call do_me_first() the compiler never actually builds it  into
the object files, so it does not get called.  In fact, it doesn't even
exist in the file.  If I call do_me_first() explicitly elsewhere, then
the method gets called at the beginning of execution properly.  Is
there any way that I can force gcc include a template without calling
it explicitly?  I was thinking that there might be an attribute or
something.

_______________________________________________
help-gplusplus mailing list
help-gplusplus@gnu.org
http://lists.gnu.org/mailman/listinfo/help-gplusplus

Reply via email to