Hi,

>> hbmk2 behaves the exact same for mingw and mingw64, 
>> yet it doesn't work for mingw64 and does for mingw.
> 
> This problem was exploited in different MINGW version.
> Not in all ones.
> Seems that now HBMK2 is tuned only for some chosen MinGW
> versions.

There is nothing special done for mingw in hbmk2, 
it uses the .c stub along the same lines as hbmk 
script.

Command line is clean from tricks. The only 
"special" thing done is '-mwindows' option.

Here is the link command:
   x86_64-w64-mingw32-gcc.exe C:\Users\vszakats\AppData\Local\Temp\a.o 
C:\Users\vszakats\AppData\Local\Temp\hbmk_oiiufu.o    -mwindows 
-Wl,--start-group -lhbextern -lhbdebug -lhbvm -lhbrtl -lhblang -lhbcpage 
-lgtcgi -lgtpca -lgtstd -lgtwin -lgtwvt -lgtgui -lhbrdd -lhbuddall -lhbusrrdd 
-lrddntx -lrddcdx -lrddnsx -lrddfpt -lhbrdd -lhbhsx -lhbsix -lhbmacro -lhbcplr 
-lhbpp -lhbcommon -lkernel32 -luser32 -lgdi32 -ladvapi32 -lws2_32 -lwinspool 
-lcomctl32 -lcomdlg32 -lshell32 -luuid -lole32 -loleaut32 -lmpr -lwinmm 
-lmapi32 -limm32 -lmsimg32 -lwininet -lhbpcre -lhbzlib  -Wl,--end-group -oa.exe 
-LF:/devl/hb20/lib/win/mingw64

>> So either it's just a coincidence that mingw works, 
>> and there is hbmk2 bug, or there is a difference 
>> in either in Harbour mingw64 builds or mingw64 
>> itself.
> 
> I noticed differences between different mi...@32
> releases so it's nothing amazing that they may
> exist also between 32 and 64 bit MinGW versions.

Yes, it seems there is something here to deal with.

>> .c stub rightly issues hb_forceLinkMainWin() in 
>> both cases, which should be enough to pull WinMain().
> 
> It not a problem of linking WinMain() but giving the
> highest priority to main().
> 
>> If I try 'hbmk2 a.prg -shared', it works, but 
>> if I try 'hbmk2 a.prg -shared -gtwvt', it tells: 
>>  'Can't locate the starting procedure: 'MAIN''
> 
> It means that using -gtwvt hbmk2 switch activates sth
> what forces using MAIN() as startup entry. We only have
> to locate what it is and fix it. For sure you cannot
> pass hbmainstd as one of linked libraries because in such
> case console application will be created.

The only difference is in .c stub content, here it is in 
diff form:
---

 HB_FUNC_EXTERN( MAIN );
+HB_FUNC_EXTERN( HB_GT_WVT );
+
+HB_EXTERN_BEGIN
+void hb_forceLinkMainWin( void );
+HB_EXTERN_END

 void _hb_lnk_ForceLink_hbmk2( void )
 {
    HB_FUNC_EXEC( MAIN );
+   HB_FUNC_EXEC( HB_GT_WVT );
+
+   hb_forceLinkMainWin();
 }

 #include "hbinit.h"

 HB_CALL_ON_STARTUP_BEGIN( _hb_hbmk_setdef_ )
+   hb_vmSetDefaultGT( "WVT" );
    hb_vmSetLinkedMain( "MAIN" );
 HB_CALL_ON_STARTUP_END( _hb_hbmk_setdef_ )
---

Does it show anything to you?

Brgds,
Viktor

_______________________________________________
Harbour mailing list (attachment size limit: 40KB)
Harbour@harbour-project.org
http://lists.harbour-project.org/mailman/listinfo/harbour

Reply via email to