mirror of
https://github.com/nim-lang/Nim.git
synced 2025-12-28 08:54:53 +00:00
* Fix 16937: Make --clib option works * Make tests/compiler/tcmdlineclib.nim works from any current dir * Try to fix link error on macosx * Add a comment to tests/compiler/tcmdlineclib.nims Co-authored-by: Clay Sweetser <Varriount@users.noreply.github.com>
This commit is contained in:
@@ -803,7 +803,7 @@ proc processSwitch*(switch, arg: string, pass: TCmdLinePass, info: TLineInfo;
|
||||
of "clib":
|
||||
expectArg(conf, switch, arg, pass, info)
|
||||
if pass in {passCmd2, passPP}:
|
||||
conf.cLinkedLibs.add processPath(conf, arg, info).string
|
||||
conf.cLinkedLibs.add arg
|
||||
of "header":
|
||||
if conf != nil: conf.headerFile = arg
|
||||
incl(conf.globalOptions, optGenIndex)
|
||||
|
||||
2
tests/compiler/samplelib.nim
Normal file
2
tests/compiler/samplelib.nim
Normal file
@@ -0,0 +1,2 @@
|
||||
# Sample library used by tcmdlineclib.nim
|
||||
proc test(): int {.cdecl, exportc, dynlib.} = 123
|
||||
3
tests/compiler/tcmdlineclib.nim
Normal file
3
tests/compiler/tcmdlineclib.nim
Normal file
@@ -0,0 +1,3 @@
|
||||
proc test(): int {.importc, cdecl.}
|
||||
|
||||
doAssert test() == 123
|
||||
10
tests/compiler/tcmdlineclib.nims
Normal file
10
tests/compiler/tcmdlineclib.nims
Normal file
@@ -0,0 +1,10 @@
|
||||
import os
|
||||
|
||||
selfExec "c --app:lib " & (projectDir() / "samplelib.nim")
|
||||
switch("clibdir", projectDir())
|
||||
--clib:samplelib
|
||||
|
||||
# Make test executable can load sample shared library.
|
||||
# `-rpath` option doesn't work and ignored on Windows.
|
||||
# But the dll file in same directory as executable file is loaded.
|
||||
switch("passL", "-Wl,-rpath," & projectDir())
|
||||
Reference in New Issue
Block a user