* Re: Dylibs
@ 2005-08-15 11:17 r_zaca
2005-08-15 12:05 ` Dylibs Steve Graegert
0 siblings, 1 reply; 4+ messages in thread
From: r_zaca @ 2005-08-15 11:17 UTC (permalink / raw)
To: linux-c-programming
[-- Attachment #1: Mail message body --]
[-- Type: text/plain, Size: 667 bytes --]
Hello,
These are construction of code that you can use before the return of
dlopen and after dlclose. For example:
void _init ()
{
printf ("init print.\n");
}
void _fini ()
{
printf ("fini print.\n");
}
The code in _init function will be run before the return of dlopen to your
program and the code in _fini will be run before the return of dlopen to
your program. You just have to put the code you actually need inside these
functions.
I hope it can help you.
Good Luck.
>Hi,
> While loading Dylibs i want to write my own __init,__fini
>functions.Would you please tell me how to write those functions >please.
>
>Raja
^ permalink raw reply [flat|nested] 4+ messages in thread* Re: Dylibs
2005-08-15 11:17 Dylibs r_zaca
@ 2005-08-15 12:05 ` Steve Graegert
0 siblings, 0 replies; 4+ messages in thread
From: Steve Graegert @ 2005-08-15 12:05 UTC (permalink / raw)
To: r_zaca; +Cc: linux-c-programming
On 8/15/05, r_zaca <r_zaca@ig.com.br> wrote:
> Hello,
[snipped some code]
The use of _init() and _fini() is strongly discouraged. Both are
obsolete and their use can lead to some strange behaviour. Some even
consider them as dangerous.
Instead, you should rely on function attribute constructors and destructors:
void __attribute__ ((constructor)) my_init(void);
void __attribute__ ((destructor)) my_fini(void);
Please note: when compiling shared libs with gcc, you _must_ omit the
arguments -nostartfiles or -nostdlib, otherwise the declared routines
will not be executed.
Regards
\Steve
>
> >Hi,
> > While loading Dylibs i want to write my own __init,__fini
> >functions.Would you please tell me how to write those functions >please.
> >
> >Raja
>
>
Steve Graegert <graegerts@gmail.com>
Software Consultancy {C/C++ && Java && .NET}
Mobile: +49 (176) 21248869
Office: +49 (9131) 7126409
^ permalink raw reply [flat|nested] 4+ messages in thread
* Dylibs
@ 2005-08-13 5:26 raja
2005-08-13 6:29 ` Dylibs Markus Rechberger
0 siblings, 1 reply; 4+ messages in thread
From: raja @ 2005-08-13 5:26 UTC (permalink / raw)
To: linux-c-programming
Hi,
While loading Dylibs i want to write my own __init,__fini
functions.Would you please tell me how to write those functions please.
Raja
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2005-08-15 12:05 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2005-08-15 11:17 Dylibs r_zaca
2005-08-15 12:05 ` Dylibs Steve Graegert
-- strict thread matches above, loose matches on Subject: below --
2005-08-13 5:26 Dylibs raja
2005-08-13 6:29 ` Dylibs Markus Rechberger
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 NNTP newsgroup(s).