Re: Creating DLL Entry Point



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
.



Relevant Pages

  • Re: import library not being created when dll is built
    ... > I used dumpbin to check the exports and you guessed right - it dosen't ... the projet does not come with a .def file. ... > This is a C++ DLL, ... That a look at the header file that defines the interface to the DLL (i.e., ...
    (microsoft.public.vc.language)
  • Re: Mapping .DEF entries in Visual Studio 2005
    ... You need to use EXPORTS, ... the project has no .DEF file for the DLL ... The linker reports that: "exports statement not supported for the target ...
    (microsoft.public.windowsce.platbuilder)
  • Re: Trouble Exporting from a Dll
    ... my understanding is that this would modify the exported symbol. ... > Try assigning an export ordinal to the function in your def file. ... >> I am writing a DLL that exports a function that is to be loaded ...
    (microsoft.public.vc.mfc)
  • Re: Trouble Exporting from a Dll
    ... Try assigning an export ordinal to the function in your def file. ... "Jonathan Wood" wrote in message ... > I am writing a DLL that exports a function that is to be loaded ...
    (microsoft.public.vc.mfc)
  • Re: How to get imagebase after a DLL gets loaded
    ... and William provided a sensible answer. ... assigned-to during DllMain PROCESS_ATTACH." ... The OP asked "how to get imagebase after a DLL gets loaded". ...
    (microsoft.public.win32.programmer.kernel)

Loading