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

writing a DLLMain in 64-bit

grant8
Beginner
1,300 Views
Hi,

I have a Fortran EXE making calls into a Fortran DLL. I have a DLLMain routine defined in the DLL, which performs initialisation stuff when the DLL gets loaded. I can set a breakpoint, and see this occurring.

But when I build theDLL and EXE both to 64-bit, the breakpoint in DLLMain is not hit. The initialisation never gets performed, and so all the other DLL methods don't work as intended. Can someone please enlighten me as to the way to define a 64-bit DLLMain method?

Cheers,
Grant
0 Kudos
1 Reply
grant8
Beginner
1,300 Views

Here is how I managed to define a DllMain procedure so that it works in both 32-bit and 64-bit.(Idea stolen from variousfunctions defined inifmt.f90).

logical(BOOL) function DllMain(hinstDll, fdwReason, lpvReserved)

!DEC$ ATTRIBUTES DEFAULT,DECORATE,STDCALL,ALIAS: "DllMain" :: DllMain

integer(HANDLE), intent(in) :: hinstDll

integer(DWORD), intent(in) :: fdwReason

integer(LPVOID), intent(in) :: lpvReserved

0 Kudos
Reply