From: Sergei Gavrikov <w3sg@SoftHome.net>
To: Edgar Grimberg <edgar.grimberg@zylin.com>
Cc: ecos-discuss@ecos.sourceware.org
Subject: Re: [ECOS] CYGBLD_ATTRIB_CONSTRUCTOR with CYGBLD_ATTRIB_INIT_PRI in C application
Date: Thu, 18 Oct 2007 20:05:00 -0000 [thread overview]
Message-ID: <20071018200426.GA6531@ubuntu> (raw)
In-Reply-To: <471751A8.8090005@zylin.com>
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
prev parent reply other threads:[~2007-10-18 20:05 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2007-10-18 12:31 Edgar Grimberg
2007-10-18 20:05 ` Sergei Gavrikov [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20071018200426.GA6531@ubuntu \
--to=w3sg@softhome.net \
--cc=ecos-discuss@ecos.sourceware.org \
--cc=edgar.grimberg@zylin.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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).