[Subject Prev][Subject Next][Thread Prev][Thread Next][Subject Index][Thread Index]

Re: Problem with _init and _fini functions



Please use extern C  while U declare that function ...
for further ... RTFM.

-KS

Saravanan Subbiah wrote:

> Hi,
>
> I am trying to create a shared library in Linux. I want my
> shared library to do some initialization on loading and some
> cleanup on unloading.
>
> I used _init and _fini functions to do the intializations. But
> since I am using C++, (g++) it is mangling the function names
> to _init__Fv and _fini__FV in the .o files
>
> As a result these functions are not called when the shared library
> is loaded and unloaded.
>
> How can I avoid this name mangling from happening ?? If it is
> a c file, then everything is working fine. i.e. no name mangling
> is happening. My shared library is written in C++. :-((
>
> Thanks in advance,
> regards,
> Saravanan S.
>
> ---------------------------------------------
> The mailing list archives are available at
> http://lists.linux-india.org/cgi-bin/wilma/LIP