Re: Creating DLL Entry Point
- From: Vincent Fatica <vince@xxxxxxxxxxxxxxxxx>
- Date: 5 Sep 2007 20:19:57 -0400
On Wed, 05 Sep 2007 15:43:49 -0700, FFrozTT <tech@xxxxxxxxxxxxxxxx> wrote:
So it appears I'm on the right track but I'm not sure if I'm exporting
DllMain properly. I have a .def file with EXPORTS then DllMain is
listed but I still think I'm missing something (actually I have seen
another .dll where there was no .def file and DllMain still works for
LoadLibrary.)
I think it's best to think of a DLL as having **one** "entry point". Typically
the entry point is DllMain (C runtime initialization is done there) but you can
specify another name if you avoid the C runtime library functions. The entry
point is specified at build time, the linker records its address in the DLL's
image headers, it is automatically called when the DLL is attached/detached, and
it doesn't need to be exported. As has been noted, whatever you call the "entry
point" only very modest processing (say, initialization) should be done there.
Serious work should be done by other functions, exported by your DLL, and called
explicitly by the host app, either because it somehow knows innately to (and how
to) do so (for example, the app has a "plugin" interface and your DLL is written
to conform to the plugin specs) or because it's executing code you have injected
into it.
--
- Vince
.
- References:
- Creating DLL Entry Point
- From: FFrozTT
- Re: Creating DLL Entry Point
- From: Joel Lucsy
- Re: Creating DLL Entry Point
- From: FFrozTT
- Creating DLL Entry Point
- Prev by Date: Outlook->GetCharsetInfo( CharSet, & _Encoding );
- Next by Date: Re: Creating DLL Entry Point
- Previous by thread: Re: Creating DLL Entry Point
- Next by thread: Re: Creating DLL Entry Point
- Index(es):
Relevant Pages
|
Loading