Commit 55328630 authored by Camil Staps's avatar Camil Staps 🍃

Improve handling of import code from library

On Windows:
- Items starting with -l are ignored
- Everything else is treated as an ASCII library file

On other platforms:
- Items starting with -l are treated as shared libraries
- Items containing a dot are treated as normal files and linked
- Other items are ignored

This allows one to use for example:

	import code from library "mylib_library"
	import code from library "-lmylib"

(where Clean System Files\mylib_library refers to mylib.dll or so).
The first entry is used on Windows; the second on non-Windows.
parent 9c1c006f
Pipeline #33957 passed with stage
in 1 minute and 20 seconds
......@@ -942,11 +942,15 @@ step intr (DLink ds=:{ok, newpaths, fileinfo, libsinfo, modpaths, abccache, proj
= GetPathNames /*abcLinkInfo.*/linkObjFileNames ofiles` srcpaths abcPathsCache ps
# (shared_libraries,library_files)
= IF_WINDOWS
(Nil, libs)
( [|l \\ (_,l) <|- libs | isSharedLibrary l]
, Filter (\(_,l) -> not (isSharedLibrary l)) libs
( [|]
, [|l \\ l=:(_,name) <|- libs | not (isSharedLibrary name)]
)
with isSharedLibrary l = size l >= 2 && l.[0]=='-' && l.[1]=='l'
( [|name \\ (_,name) <|- libs | isSharedLibrary name]
, [|l \\ l=:(_,name) <|- libs | not (isSharedLibrary name) && has_dot (size name-1) name]
)
with
isSharedLibrary l = size l >= 2 && l.[0]=='-' && l.[1]=='l'
has_dot i l = if (i<0) False (l.[i]=='.' || has_dot (i-1) l)
# (libPathsOk,lfiles,abcPathsCache, ps)
= GetPathNames library_files lfiles srcpaths abcPathsCache ps
| not objPathsOk
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment