Difference between revisions of "Talk:TUT:Writing a Dynamically Loadable Object"

From Net-SNMP Wiki
Jump to: navigation, search
(Why is loading an object multiple times a problem?)
 
(Answer question)
Line 1: Line 1:
 
How is loading the shared object multiple times problematic? As long as non-static symbols of the are not exported by default, both objects should live in their private little happy place. Actually, I doubt that setting <code>RTLD_GLOBAL</code> or similar would be a problem, because actually not symbol resolution takes place.. octo 21:45, 3 March 2009 (UTC)
 
How is loading the shared object multiple times problematic? As long as non-static symbols of the are not exported by default, both objects should live in their private little happy place. Actually, I doubt that setting <code>RTLD_GLOBAL</code> or similar would be a problem, because actually not symbol resolution takes place.. octo 21:45, 3 March 2009 (UTC)
 +
 +
The problem is that dlopening the same module a second time will return a reference to the same object as the first dlopen, so both copies will work with the same static data. magfr 2009-03-04T22:07 UTC

Revision as of 22:09, 4 March 2009

How is loading the shared object multiple times problematic? As long as non-static symbols of the are not exported by default, both objects should live in their private little happy place. Actually, I doubt that setting RTLD_GLOBAL or similar would be a problem, because actually not symbol resolution takes place.. octo 21:45, 3 March 2009 (UTC)

The problem is that dlopening the same module a second time will return a reference to the same object as the first dlopen, so both copies will work with the same static data. magfr 2009-03-04T22:07 UTC