Usenet comp.unix.osf.osf1 (1992-2004)
 help / color / mirror / Atom feed
From: ccrlphr@xensei.com
Subject: dlopen/dlclose & C++ (DEC UNIX)
Date: 1996/03/25	[thread overview]
Message-ID: <4j6q8e$ucf@xensei3.xensei.com> (raw)


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 <loaderFunc> which gets mapped
with <dlsym> after loading the lib with <dlopen>. 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 <dlclose>. I delete all
objects from the <dynalib> and expected to have no more references into the library
so I call <dlclose>. I get no error back with <dlerror> 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 <dlopen>")


--
+++ Steffen Ullrich +++ ccrlphr@xensei.com +++ http://www.xensei.com/users/ccrlphr/ +++



             reply	other threads:[~1996-03-25  5:00 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
1996-03-25  5:00 ccrlphr [this message]
1996-03-27  5:00 ` dlopen/dlclose & C++ (DEC UNIX) Alan H. Martin
read-only archive

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox