@@ -1381,26 +1381,27 @@ private function hLinkFiles( ) as integer
13811381 exit function
13821382 end if
13831383 # elseif defined( __FB_WIN32__ )
1384+ dim forcefile As Long
1385+ dim targetprefixlen As ULong
13841386 #ifdef ENABLE_STANDALONE
13851387 '' "cross"-compiling? djgpp cross tools and emscripten
13861388 '' build tools can't seem to handle the long command line
13871389 '' created when linking ./tests/fbc-tests
13881390 select case fbGetOption( FB_COMPOPT_TARGET )
13891391 case FB_COMPTARGET_DOS, FB_COMPTARGET_JS
1390- if ( hPutLdArgsIntoFile( ldcline ) = FALSE ) then
1391- exit function
1392- end if
1392+ forcefile = 1
13931393 end select
13941394 # else
1395- dim toolnamelen as integer = len( "ld.exe " ) + _
1396- iif( len( fbc.targetprefix ) > len( fbc.buildprefix ), len( fbc.targetprefix ), len( fbc.buildprefix ) )
1397- if ( (fbGetOption( FB_COMPOPT_TARGET ) = FB_COMPTARGET_DOS) or _
1398- (len( ldcline ) > ( 2047 - toolnamelen)) ) then
1399- if ( hPutLdArgsIntoFile( ldcline ) = FALSE ) then
1400- exit function
1401- end if
1402- end if
1395+ targetprefixlen = len( fbc.targetprefix )
14031396 # endif
1397+ dim toolnamelen as integer = len( "ld.exe " ) + _
1398+ iif( targetprefixlen > len( fbc.buildprefix ), targetprefixlen, len( fbc.buildprefix ) )
1399+ if ( forcefile OrElse (fbGetOption( FB_COMPOPT_TARGET ) = FB_COMPTARGET_DOS) or _
1400+ (len( ldcline ) > ( 2047 - toolnamelen)) ) then
1401+ if ( hPutLdArgsIntoFile( ldcline ) = FALSE ) then
1402+ exit function
1403+ end if
1404+ end if
14041405 # endif
14051406
14061407 '' invoke ld
@@ -4162,6 +4163,22 @@ private function hArchiveFiles( ) as integer
41624163 ar = FBCTOOL_EMAR
41634164 end if
41644165
4166+ '' See comment in hLinkFiles about command line lengths
4167+ # if defined( __FB_WIN32__ ) or defined( __FB_DOS__ )
4168+ dim targetprefixlen as ulong
4169+ #ifndef ENABLE_STANDALONE
4170+ targetprefixlen = len( fbc.targetprefix )
4171+ # endif
4172+ dim toolnamelen as integer = len( fbctoolTB( ar ).name + ".exe" ) + _
4173+ iif( targetprefixlen > len( fbc.buildprefix ), targetprefixlen, len( fbc.buildprefix ) )
4174+ if ( (fbGetOption( FB_COMPOPT_TARGET ) = FB_COMPTARGET_DOS) or _
4175+ (len( ln ) > ( 2047 - toolnamelen)) ) then
4176+ if ( hPutLdArgsIntoFile( ln ) = FALSE ) then
4177+ exit function
4178+ end if
4179+ end if
4180+ # endif
4181+
41654182 '' invoke ar
41664183 function = fbcRunBin( "archiving" , ar, ln )
41674184end function
0 commit comments