public inbox for ecos-discuss@sourceware.org
 help / color / mirror / Atom feed
* [ECOS] CYGBLD_ATTRIB_CONSTRUCTOR with CYGBLD_ATTRIB_INIT_PRI in C application
@ 2007-10-18 12:31 Edgar Grimberg
  2007-10-18 20:05 ` Sergei Gavrikov
  0 siblings, 1 reply; 2+ messages in thread
From: Edgar Grimberg @ 2007-10-18 12:31 UTC (permalink / raw)
  To: ecos-discuss

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?

Edgar

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

^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: [ECOS] CYGBLD_ATTRIB_CONSTRUCTOR with CYGBLD_ATTRIB_INIT_PRI in C application
  2007-10-18 12:31 [ECOS] CYGBLD_ATTRIB_CONSTRUCTOR with CYGBLD_ATTRIB_INIT_PRI in C application Edgar Grimberg
@ 2007-10-18 20:05 ` Sergei Gavrikov
  0 siblings, 0 replies; 2+ messages in thread
From: Sergei Gavrikov @ 2007-10-18 20:05 UTC (permalink / raw)
  To: Edgar Grimberg; +Cc: ecos-discuss

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

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2007-10-18 20:05 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2007-10-18 12:31 [ECOS] CYGBLD_ATTRIB_CONSTRUCTOR with CYGBLD_ATTRIB_INIT_PRI in C application Edgar Grimberg
2007-10-18 20:05 ` Sergei Gavrikov

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).