[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: |
Tue, 23 May 2006 10:21:16 -0700 |
User-agent: |
Gnus/5.1006 (Gnus v5.10.6) XEmacs/21.4 (Jumbo Shrimp, linux) |
"Paulo Matos" <pocmatos@gmail.com> writes:
> Problem is that sometimes (I know this is not
> usual in current software but I really need this) I need to pack all
> the software and plugins into one big piece of code so I link every
> plugin statically to the core.
This should work just fine.
You still have your global objects, and their constructors should
still be firing at process startup.
> However, this proxy approach doesn't
> seem to work because the plugins are not registering themselves.
They probably are. Run your program in debugger, set a breakpoint on
'proxy::proxy()' and observe that the breakpoint is hit.
What is probably preventing this from working is that "factory"
itself has not been constructed yet (the order of construction for
globals from separate translation units is unspecified).
So you must modify your code to insure that it is constructed before
any plugin tries to register with it, e.g.:
proxy() { getFactory()->insert("shape name", maker); }
where getFactory() constructs the "factory" singleton on the
first call, and returns it again on all subsequent ones.
Cheers,
--
In order to understand recursion you must first understand recursion.
Remove /-nsp/ for email.
- Running initial code when in library, Paulo Matos, 2006/05/23
- Re: Running initial code when in library,
Paul Pluzhnikov <=
- 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, 2006/05/25