From mboxrd@z Thu Jan 1 00:00:00 1970 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: fc89c,c6b158c26aecc01c,start X-Google-Attributes: gidfc89c,public X-Google-Thread: fee84,c6b158c26aecc01c,start X-Google-Attributes: gidfee84,public From: ccrlphr@xensei.com Subject: dlopen/dlclose & C++ (DEC UNIX) Date: 1996/03/25 Message-ID: <4j6q8e$ucf@xensei3.xensei.com>#1/1 X-Deja-AN: 144192041 organization: none newsgroups: comp.unix.osf.osf1,comp.unix.programmer I got a problem while using the dynamic loading with C++ (DEC CXX 5.0). I wrote a app which defines an interface == class within a header file and lets you dynamically load libraries with this interface within the run of the prog, e.g.: .......... file interface.hxx ............ struct interface { virtual void anyfunc() { /* default impl */ } virtual ~interface() {} }; .......... file dynalib.hxx ................ #include "interface.hxx" struct dynalib: interface { void anyfunc() { /* implementation */ } virtual ~dynalib {} dynalib(... ) { ... } }; extern "C" interface *loaderFunc( ... ) { return new dynalib( ... ); } each of the shared libs must declare a function which gets mapped with after loading the lib with . All this stuff works and I can call any function of the object == shared lib ... My problem starts if I don't need the lib any longer and want to get the memory back using . I delete all objects from the and expected to have no more references into the library so I call . I get no error back with and can continue the app w/o problems - but if it should finish it crashes in <__fini_cleanup> with an "invalid symbol descriptor ... for symbol ... " as argument. I guess it tries to call a cleanup function within the shared lib which is no longer in the memory. This generates the question if this is a) a general problem between C++ and the dl-library b) a problem between DEC CXX (V5.0) and the dl-library c) a problem on DEC UNIX (osf/1 V.3.2C) d) a problem of misusage e) nothing of the above I guess it's b) or c) because I had no problems with the same code on sparc/CC. BTW, does anybody knows a workaround ?? (except "not calling ") -- +++ Steffen Ullrich +++ ccrlphr@xensei.com +++ http://www.xensei.com/users/ccrlphr/ +++