[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
attribute on a static member of a template class
From: |
jinxidoru |
Subject: |
attribute on a static member of a template class |
Date: |
5 May 2006 09:44:48 -0700 |
User-agent: |
G2/0.2 |
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.
- attribute on a static member of a template class,
jinxidoru <=