1 This document describes some points you should know before implementing
2 the internal counterparts to external DLL's. Only 32 bit DLL's
5 1. The LibMain function
6 -----------------------
7 This is the way to do some initializing when a process or thread is attached
8 to the dll. The function name is taken from a *.spec file line:
12 then, you have to implement the function:
15 BOOL32 WINAPI YourLibMain(HINSTANCE32 hinstDLL,
16 DWORD fdwReason, LPVOID lpvReserved)
17 { if (fdwReason==DLL_PROCESS_ATTACH)
24 2. Using functions from other built-in DLL's
25 --------------------------------------------
26 The problem here is, that you can't know if you have to call the function from
27 the internal or the external DLL. If you just call the function you will get
28 the internal implementation. If the external DLL is loaded the executed program
29 will use the external DLL and you the internal one.
30 When you -as an example- fill an iconlist placed in the internal DLL the
31 application won't get the icons from the external DLL.
33 To work around this, you should always use a pointer to call such functions:
35 /* definition of the pointer type*/
36 void (CALLBACK* pDLLInitComctl)();
38 /* getting the function address this should be done in the
39 LibMain function when called with DLL_PROCESS_ATTACH*/
41 BOOL32 WINAPI Shell32LibMain(HINSTANCE32 hinstDLL, DWORD fdwReason,
43 { HINSTANCE32 hComctl32;
44 if (fdwReason==DLL_PROCESS_ATTACH)
45 { /* load the external / internal DLL*/
46 hComctl32 = LoadLibrary32A("COMCTL32.DLL");
48 { /* get the function pointer */
49 pDLLInitComctl=GetProcAddress32(hComctl32,"InitCommonControlsEx");
57 /* free the DLL / decrease the ref count */
58 FreeLibrary32(hComctl32);
62 ERR(shell,"P A N I C error getting functionpointers\n");
68 3. Getting resources from a *.rc file linked to the DLL
69 -------------------------------------------------------
70 < If you know how, write some lines>
75 <juergen.schmied@metronet.de>