help-gplusplus
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Running initial code when in library


From: Paulo Matos
Subject: Re: Running initial code when in library
Date: 23 May 2006 11:51:00 -0700
User-agent: G2/0.2

Paul Pluzhnikov wrote:
> "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.
>

I have singleton and everything should work fine but it is not:
extern "C" {
  esatEnumerator *create() {
    return new esatEnumeratorCR();
  }
  void destroy(esatEnumerator *e) {
    delete e;
  }
  class proxy {
  public:
    proxy() {
      esatModuleDispatcher::Instance()->registerEnumerator(create,
destroy);
    }
  };
  proxy p;
}


This should be working but it is not. esatModuleDispatcher::Instance()
returns the singleton instance. Even if I add a exit(EXIT_FAILURE);
before the call nothing happens. Execution is not hitting proxy
constructor.



reply via email to

[Prev in Thread] Current Thread [Next in Thread]