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

Re: Problem with _init and _fini functions



Protect the functions names from being mangled, by using

extern "C" {

function_decl;

}



On Tue, 14 Nov 2000, 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
> 

-- 
Sojan James
Consultant, National Semi. India Designs Ltd.
7/6 Brunton Road, Bangalore 560025. India.
Ph: 5587918/919/920 ext. 308