Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
39 changes: 28 additions & 11 deletions src/compiler/fbc.bas
Original file line number Diff line number Diff line change
Expand Up @@ -1381,26 +1381,27 @@ private function hLinkFiles( ) as integer
exit function
end if
#elseif defined( __FB_WIN32__ )
dim forcefile As Long
dim targetprefixlen As ULong
#ifdef ENABLE_STANDALONE
'' "cross"-compiling? djgpp cross tools and emscripten
'' build tools can't seem to handle the long command line
'' created when linking ./tests/fbc-tests
select case fbGetOption( FB_COMPOPT_TARGET )
case FB_COMPTARGET_DOS, FB_COMPTARGET_JS
if( hPutLdArgsIntoFile( ldcline ) = FALSE ) then
exit function
end if
forcefile = 1
end select
#else
dim toolnamelen as integer = len( "ld.exe " ) + _
iif( len( fbc.targetprefix ) > len( fbc.buildprefix ), len( fbc.targetprefix ), len( fbc.buildprefix ) )
if( (fbGetOption( FB_COMPOPT_TARGET ) = FB_COMPTARGET_DOS) or _
(len( ldcline ) > (2047 - toolnamelen)) ) then
if( hPutLdArgsIntoFile( ldcline ) = FALSE ) then
exit function
end if
end if
targetprefixlen = len( fbc.targetprefix )
#endif
dim toolnamelen as integer = len( "ld.exe " ) + _
iif( targetprefixlen > len( fbc.buildprefix ), targetprefixlen, len( fbc.buildprefix ) )
if( forcefile OrElse (fbGetOption( FB_COMPOPT_TARGET ) = FB_COMPTARGET_DOS) or _
(len( ldcline ) > (2047 - toolnamelen)) ) then
if( hPutLdArgsIntoFile( ldcline ) = FALSE ) then
exit function
end if
end if
#endif

'' invoke ld
Expand Down Expand Up @@ -4162,6 +4163,22 @@ private function hArchiveFiles( ) as integer
ar = FBCTOOL_EMAR
end if

'' See comment in hLinkFiles about command line lengths
#if defined( __FB_WIN32__ ) or defined( __FB_DOS__ )
dim targetprefixlen as ulong
#ifndef ENABLE_STANDALONE
targetprefixlen = len( fbc.targetprefix )
#endif
dim toolnamelen as integer = len( fbctoolTB( ar ).name + ".exe" ) + _
iif( targetprefixlen > len( fbc.buildprefix ), targetprefixlen, len( fbc.buildprefix ) )
if( (fbGetOption( FB_COMPOPT_TARGET ) = FB_COMPTARGET_DOS) or _
(len( ln ) > (2047 - toolnamelen)) ) then
if( hPutLdArgsIntoFile( ln ) = FALSE ) then
exit function
end if
end if
#endif

'' invoke ar
function = fbcRunBin( "archiving", ar, ln )
end function
Expand Down