|
From: Haziq W. <haz...@ho...> - 2009-10-14 06:18:29
|
Hi, I am a new user, so please overlook any mistakes or failure to follow the rules that I yet don't know. I wonder if anybody has noticed this problem before. When the DLLs using MingW compiler are loaded into the memory, the function DllMain() never gets called. This is where we receive an instance handle, so it is absolutely important that this function be called. I actually encountered the problem when I was trying to write a mouse hook routine that I had successfully implemented before using VC++ compiler. We need to pass an instance handle to this routine that we receive in DllMain from the operating system. However, when the Dll built using mingW compiler consistently failed, I noticed that the handle received in DllMain is a null pointer. Then, using a message box, I found out that the main entry point of the Dll is never called by the operating system. It may be worth noting that the message box is displayed when using a VC++ compiler. I have tried it on Windows XP service pack 2 and Windows 7 operating systems. Problem happens in both the environments. Earlier I used the MingW 3.4.5 compiler. Then, I downloaded the MingW-4.4 compiler but even this didn't solve the problem. To make it sure that DllMain isn't called, I even changed the value of a global variable(integer) in DllMain() but the value never changes, proving 100% that DllMain is not called. It may be worth noting that other user defined functions are called from the Dll. Please reply. _________________________________________________________________ News, views and inimitable perspectives – On MSN India, you get an all-round view of things that matter. http://in.msn.com |