-
-
Notifications
You must be signed in to change notification settings - Fork 1.5k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix #16937; --clib option pass library name to backend C compiler cor…
…rectly (#19754) * 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 <[email protected]>
- Loading branch information
1 parent
a95b639
commit 2a34d14
Showing
4 changed files
with
16 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
# Sample library used by tcmdlineclib.nim | ||
proc test(): int {.cdecl, exportc, dynlib.} = 123 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
proc test(): int {.importc, cdecl.} | ||
|
||
doAssert test() == 123 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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()) |