For Programmers: Free Programming Magazines  


Home > Archive > Unix Programming > January 2008 > Common code among main executable and shared objects









You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

 

Author Common code among main executable and shared objects
Bhawna

2008-01-29, 4:38 am

Hi,

We are using a multithreaded application which has a few dynamic
shared objects associated with it. We are running it on Linux
platform. Few of the classes and code part is common among main
executable and other DSOs. The DSOs have been linked using linker
option -Bsymbolic and so are able to keep their seperate objects for
common classes.

The issue we are having is we want to keep a true singleton of the
common class without disturbing current linker option. For this
purpose, we are allocating a new TLS key and putting this key into
environment, so that once initialised same object is used among all
DSOs.

The simplified design of the class can be considered as follows

class singleton{



Sponsored Links







Also available: Server administration forum archive | Web Design forum archive | Software forum archive | Hardware reviews archive

Copyright 2008 codecomments.com