Intel® Fortran Compiler
Build applications that can scale for the future with optimized code designed for Intel® Xeon® and compatible processors.
28857 Discussions

DllMain not being called on loading the DLL under Win32 config

ferrad1
New Contributor I
508 Views

I'm almost done creating a Win32 version of my project which works fine under x64.

The problem I am having at the moment is that the DllMain function in my DLL is not being called when the DLL is being loaded.  It is being called under x64.

Do I have to do something special to get it to be called under Win32?

0 Kudos
3 Replies
Steve_Lionel
Honored Contributor III
488 Views

You have to give it the correct name. On 32-bit, it is a STDCALL routine _DllMain@12 . (Use !DEC$ ATTRIBUTES STDCALL, DLLEXPORT, ALIAS:"_DllMain@12"). 

0 Kudos
ferrad1
New Contributor I
421 Views

That worked, thanks (I added :: DllMain at the end)

!DEC$ ATTRIBUTES STDCALL, DLLEXPORT, ALIAS:"_DllMain@12" :: DllMain

0 Kudos
FortranFan
Honored Contributor III
480 Views
0 Kudos
Reply