This is the mail archive of the ecos-discuss@sourceware.org mailing list for the eCos project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: CYGBLD_ATTRIB_CONSTRUCTOR with CYGBLD_ATTRIB_INIT_PRI in C application


On Thu, Oct 18, 2007 at 02:29:28PM +0200, Edgar Grimberg wrote:
> Hi,
> 
> Is it possible to have CYGBLD_ATTRIB_CONSTRUCTOR  with 
> CYGBLD_ATTRIB_INIT_PRI in a C application and have the priority taken 
> into account?
 
I don't think that is allowed in pure C. But, in C you can call all
initializing functions according it's priorities from some place if you
describe the entries using CYG_HAL_TABLE_QUALIFIED_ENTRY macro. Look at
redboot.h, please. There is same constructions for that. It seems that
RedBoot_init(_f_, _p_) macro is that what you wanted.

Such a macro will let you easy to register the initializers from any C
file or module

MyApp_init(_foo_init, MyApp_INIT_FIRST);
..

MyApp_init(_bar_init, MyApp_INIT_BEFORE_THAT);
..

And your cyg_start() or other place must have the iterator(s) for the
init table(s) which makes a smart job of it

    for (init_entry = __MyApp_INIT_TAB__;
         init_entry != &__MyApp_INIT_TAB_END__; init_entry++) {
        (*init_entry->fun) ();
    }


--
Sergei


-- 
Before posting, please read the FAQ: http://ecos.sourceware.org/fom/ecos
and search the list archive: http://ecos.sourceware.org/ml/ecos-discuss


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]