"Paulo Matos" <[EMAIL PROTECTED]> 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.
_______________________________________________
help-gplusplus mailing list
help-gplusplus@gnu.org
http://lists.gnu.org/mailman/listinfo/help-gplusplus

Reply via email to