> > In compiled 64 bit dll, there is no any code on entry point which jumps / calls to DllMain.
> >
>
> This is normal since when you load the library, the loader calls libMain
>
The problem that it didn't. LoadLibrary from 64-bit lcc-compiled exe didn't call libMain from 64 bit lcc-compiled dll. Dll is loaded and in memory, but no call. With 32 bit all ok. It seems there is some problem in loader code. When i changed Entry Point to func export address with hex editor, LoadLibrary started to work OK.
lcclnk64 -nounderscores -s -dll -subsystem windows -entry LibMain
declared as
BOOL __declspec(dllexport) LibMain(...