[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Running initial code when in library
From: |
Paul Pluzhnikov |
Subject: |
Re: Running initial code when in library |
Date: |
Wed, 24 May 2006 21:03:18 -0700 |
User-agent: |
Gnus/5.1006 (Gnus v5.10.6) XEmacs/21.4 (Jumbo Shrimp, linux) |
"Paulo Matos" <pocmatos@gmail.com> writes:
> Isn't this a normal
> problem: an interface with some libraries using the interface. The core
> creates and destroys the object of the libraries through the interface.
No, I don't believe this is a widely-used design pattern,
at least not with static linking.
> This seems a normal issue which turns out to be a nightmare
> to solve. :-/
Firstly, your nightmare is entirely of your own doing.
Secondly, it has trivial solutions.
One I already mentioned: listing objects explicitly.
Here is another:
- rename your "registration" objects such that their names are
unique, e.g. instead of "proxy p;" say
proxy p_libbf; // in libbf.a
proxy p_libot; // in libot.a
// etc.
- into your main.o add this:
#ifdef PULL_LIBBF
extern proxy p_libbf;
proxy &p_libbf_ref = p_libbf;
#endif
// etc.
- now you can control what is pulled into the static link:
g++ -DPULL_LIBBF main.cc -c
- link just the way you do now, and the object(s) that you need
from libbf.a will be pulled in into the main exe, because p_libbf
is now on the "needed" list.
Cheers,
--
In order to understand recursion you must first understand recursion.
Remove /-nsp/ for email.
- Re: Running initial code when in library, (continued)
- Re: Running initial code when in library, Paul Pluzhnikov, 2006/05/23
- Re: Running initial code when in library, Paulo Matos, 2006/05/23
- Re: Running initial code when in library, Paul Pluzhnikov, 2006/05/23
- Re: Running initial code when in library, Paulo Matos, 2006/05/23
- Re: Running initial code when in library, Paul Pluzhnikov, 2006/05/23
- Re: Running initial code when in library, Paulo Matos, 2006/05/23
- Re: Running initial code when in library, Paul Pluzhnikov, 2006/05/23
- Re: Running initial code when in library, Paulo Matos, 2006/05/24
- Re: Running initial code when in library, Paul Pluzhnikov, 2006/05/24
- Re: Running initial code when in library, Paulo Matos, 2006/05/24
- Re: Running initial code when in library,
Paul Pluzhnikov <=
- Re: Running initial code when in library, Paulo Matos, 2006/05/25
- Re: Running initial code when in library, Paul Pluzhnikov, 2006/05/25
- Re: Running initial code when in library, Paulo Matos, 2006/05/25