Re: [CMake] Newbie question: Static linking

2011-05-23 Thread Michael Hertling
On 05/23/2011 08:42 PM, Sanatan Rai wrote: > On 23 May 2011 17:46, Michael Hertling wrote: >> In summary, this whole issue is not related to C++ or even to CMake, >> but to the manner static libraries are handled: The linker - at least >> the GNU one - picks out entire object files, or drops them

Re: [CMake] Newbie question: Static linking

2011-05-23 Thread Rolf Eike Beer
Sanatan Rai wrote: > Unfortunately, I am stuck with the paradigm of having to kludge loading an > entire library. For various reasons the one may not have a reference to > the hosted object in main, which must remain agnostic. Indeed, in my > particular line of business (finance), this happens to

Re: [CMake] Newbie question: Static linking

2011-05-23 Thread Sanatan Rai
On 23 May 2011 17:46, Michael Hertling wrote: > On 05/23/2011 05:09 PM, Sanatan Rai wrote: >> On 23 May 2011 16:00, Michael Wild wrote: >>> Everything that relies on static/global initialization to register >>> factories is an implicit scheme. An explicit scheme is where the >>> dependent code (e

Re: [CMake] Newbie question: Static linking

2011-05-23 Thread Michael Hertling
On 05/23/2011 05:09 PM, Sanatan Rai wrote: > On 23 May 2011 16:00, Michael Wild wrote: >> Everything that relies on static/global initialization to register >> factories is an implicit scheme. An explicit scheme is where the >> dependent code (e.g. the main() function) calls a function to do the >

Re: [CMake] Newbie question: Static linking

2011-05-23 Thread Michael Wild
On 05/23/2011 05:09 PM, Sanatan Rai wrote: > On 23 May 2011 16:00, Michael Wild wrote: >> Everything that relies on static/global initialization to register >> factories is an implicit scheme. An explicit scheme is where the >> dependent code (e.g. the main() function) calls a function to do the >

Re: [CMake] Newbie question: Static linking

2011-05-23 Thread David Cole
On Mon, May 23, 2011 at 10:51 AM, Sanatan Rai wrote: > On 23 May 2011 15:11, Michael Wild wrote: > >>> Yes, but you are registering the concrete factories implicitly instead > >>> of explicitly, which is causing you the trouble you experience. > >>> > >>> Better have your user provide a function

Re: [CMake] Newbie question: Static linking

2011-05-23 Thread Michael Jackson
On May 23, 2011, at 11:09 AM, Sanatan Rai wrote: > On 23 May 2011 16:00, Michael Wild wrote: >> Everything that relies on static/global initialization to register >> factories is an implicit scheme. An explicit scheme is where the >> dependent code (e.g. the main() function) calls a function to

Re: [CMake] Newbie question: Static linking

2011-05-23 Thread Sanatan Rai
On 23 May 2011 16:00, Michael Wild wrote: > Everything that relies on static/global initialization to register > factories is an implicit scheme. An explicit scheme is where the > dependent code (e.g. the main() function) calls a function to do the > registration. Ok, got you. However, would t

Re: [CMake] Newbie question: Static linking

2011-05-23 Thread Michael Wild
On 05/23/2011 04:51 PM, Sanatan Rai wrote: > On 23 May 2011 15:11, Michael Wild wrote: Yes, but you are registering the concrete factories implicitly instead of explicitly, which is causing you the trouble you experience. Better have your user provide a function registering his

Re: [CMake] Newbie question: Static linking

2011-05-23 Thread Sanatan Rai
On 23 May 2011 15:11, Michael Wild wrote: >>> Yes, but you are registering the concrete factories implicitly instead >>> of explicitly, which is causing you the trouble you experience. >>> >>> Better have your user provide a function registering his/her classes >>> explicitly. >> >> I guess this i

Re: [CMake] Newbie question: Static linking

2011-05-23 Thread aaron . meadows
>-Original Message- >From: cmake-boun...@cmake.org [mailto:cmake-boun...@cmake.org] On Behalf Of Michael Wild >Sent: Monday, May 23, 2011 9:12 AM >To: cmake@cmake.org >Subject: Re: [CMake] Newbie question: Static linking > >On 05/23/2011 03:25 PM, Sanatan Rai wrote: &g

Re: [CMake] Newbie question: Static linking

2011-05-23 Thread Michael Wild
On 05/23/2011 04:40 PM, aaron.mead...@thomsonreuters.com wrote: >> -Original Message- >> From: cmake-boun...@cmake.org [mailto:cmake-boun...@cmake.org] On > Behalf Of Michael Wild >> Sent: Monday, May 23, 2011 9:12 AM >> To: cmake@cmake.org >> Subject: Re

Re: [CMake] Newbie question: Static linking

2011-05-23 Thread Michael Jackson
On May 23, 2011, at 10:11 AM, Michael Wild wrote: > On 05/23/2011 03:25 PM, Sanatan Rai wrote: >> On 23 May 2011 13:38, Michael Wild wrote: >>> On 05/23/2011 02:20 PM, Sanatan Rai wrote: On 23 May 2011 12:54, Michael Jackson wrote: > You might want to take a look at the Factory design p

Re: [CMake] Newbie question: Static linking

2011-05-23 Thread Michael Wild
On 05/23/2011 03:25 PM, Sanatan Rai wrote: > On 23 May 2011 13:38, Michael Wild wrote: >> On 05/23/2011 02:20 PM, Sanatan Rai wrote: >>> On 23 May 2011 12:54, Michael Jackson wrote: You might want to take a look at the Factory design pattern. >>> >>> That's exactly what I use... >>> >>>

Re: [CMake] Newbie question: Static linking

2011-05-23 Thread Sanatan Rai
On 23 May 2011 13:38, Michael Wild wrote: > On 05/23/2011 02:20 PM, Sanatan Rai wrote: >> On 23 May 2011 12:54, Michael Jackson wrote: >>> You might want to take a look at the Factory design pattern. >>> >> >> That's exactly what I use... >> >> --Sanatan > > Yes, but you are registering the concr

Re: [CMake] Newbie question: Static linking

2011-05-23 Thread Michael Wild
On 05/23/2011 02:20 PM, Sanatan Rai wrote: > On 23 May 2011 12:54, Michael Jackson wrote: >> You might want to take a look at the Factory design pattern. >> > > That's exactly what I use... > > --Sanatan Yes, but you are registering the concrete factories implicitly instead of explicitly, which

Re: [CMake] Newbie question: Static linking

2011-05-23 Thread Sanatan Rai
On 23 May 2011 12:54, Michael Jackson wrote: > You might want to take a look at the Factory design pattern. > That's exactly what I use... --Sanatan ___ Powered by www.kitware.com Visit other Kitware open-source projects at http://www.kitware.com/ope

Re: [CMake] Newbie question: Static linking

2011-05-23 Thread Michael Jackson
You might want to take a look at the Factory design pattern. - Mike Jackson www.bluequartz.net Principal Software Engineer mike.jack...@bluequartz.net BlueQuartz Software Dayton, Ohio Sent from my mobile device. On May 23, 2011, at 5:51, Sanatan Rai wr

Re: [CMake] Newbie question: Static linking

2011-05-23 Thread Sanatan Rai
On 23 May 2011 10:18, Michael Wild wrote: > On 05/23/2011 10:23 AM, Hendrik Sattler wrote: >> Zitat von Sanatan Rai : >>> The `global initialisation' stuff is just the following pattern: >>> >>> namespace { >>>   helper1 *helper1Creator() >>>   { >>>     return (new helper1()); >>>   } >>>   const

Re: [CMake] Newbie question: Static linking

2011-05-23 Thread Michael Wild
On 05/23/2011 10:23 AM, Hendrik Sattler wrote: > Zitat von Sanatan Rai : >> The `global initialisation' stuff is just the following pattern: >> >> namespace { >> helper1 *helper1Creator() >> { >> return (new helper1()); >> } >> const bool helper1Registered = factory::instance().register

Re: [CMake] Newbie question: Static linking

2011-05-23 Thread Hendrik Sattler
Zitat von Sanatan Rai : The `global initialisation' stuff is just the following pattern: namespace { helper1 *helper1Creator() { return (new helper1()); } const bool helper1Registered = factory::instance().registerhelper ("helper1", helper1Creator); } So when I put the helpers i

Re: [CMake] Newbie question: Static linking

2011-05-23 Thread Sanatan Rai
On 23 May 2011 00:53, Hendrik Sattler wrote: > Am Montag, 23. Mai 2011, 01:36:14 schrieb Sanatan Rai: >> After cmake, and make all, the libraries build as static archives, ie I get >> liblib1.a, liblib2.a, libhelper1.a, libhelper2.a and executable myProj in >> the appropriate locations. However, t

Re: [CMake] Newbie question: Static linking

2011-05-22 Thread Hendrik Sattler
Am Montag, 23. Mai 2011, 01:36:14 schrieb Sanatan Rai: > After cmake, and make all, the libraries build as static archives, ie I get > liblib1.a, liblib2.a, libhelper1.a, libhelper2.a and executable myProj in > the appropriate locations. However, the executable myProj does not appear > to have link

[CMake] Newbie question: Static linking

2011-05-22 Thread Sanatan Rai
Hi folks, This has probably been done to death before, so apologies in advance. I have a project wherein I want all the project libraries to be linked statically to the final executables. I certainly get static libraries when I run make, however, two of the libraries don't seem to link s