Re: DLL help
- From: Jonathan Lee <chorus@xxxxxxx>
- Date: Fri, 12 Jun 2009 04:59:44 -0700 (PDT)
Hello Goran and Joseph,
thank you for your comments. I'll give the recommendations a try and
your
warnings due notice.
Please tell good people here what are you actually trying to achieve,
Auto-registration of a plugin. The shared library includes an object
like so:
AutoRegistrationClass dummy("Plugin name",
factory_create_function, factory_destroy_function);
When the plugin is loaded, the constructor connects to the application
and
informs it of the plugin's meta-data. Note that the plugin is not
meant to be
used in other applications; it is not very "reusable". Also, both the
application
and plugin agree on an interface. Part of that agreement is the
existence
of an object in the calling application to register with. So while I
see both of
your concerns about exporting from the exe, I don't see it as being
the
nightmare you describe. If the symbol doesn't exist, the plugin
doesn't load.
That's appropriate behavior.
there must be a better way - and for you, too ;-).I can and have allowed the option for the plugin implementer to
provide
callback functions. The auto-registration is meant to be a convenient
alternative. One line of code vs twenty.
Hmmm... How did you conclude that? By the time your code gets controlI determined that because the side-effects of DllMain don't happen,
back from LoadLibrary, DllMain is called
and
yet LoadLibrary() returns OK. I missed a part of an article last night
about
DllMain being a place-holder name and I have to notify the compiler.
I'll
have to see how that's done since I'm using Qt's build system and it
doesn't really let you manually add compiler options like that...
Anyway, thanks again for the advice
--Jonathan
.
- Follow-Ups:
- Re: DLL help
- From: David Webber
- Re: DLL help
- From: Goran
- Re: DLL help
- References:
- DLL help
- From: Jonathan Lee
- Re: DLL help
- From: Goran
- DLL help
- Prev by Date: Re: Migrating an application from ( VC6.0 to ) vs 2003 in MFC/C++ to VS2008
- Next by Date: Re: A new Frame support plug-in
- Previous by thread: Re: DLL help
- Next by thread: Re: DLL help
- Index(es):
Relevant Pages
|