compiler/ccgtypes: hide exportc proc unless it has dynlib (#13199)
This hides most of stdlib's internal functions from resulting binaries/libraries, where they aren't needed on *nix. Static libraries are not affected by this change (visibility doesn't apply to them).
This commit is contained in:
parent
da1bddb084
commit
470faa97c6
3 changed files with 24 additions and 1 deletions
19
tests/dll/visibility.nim
Normal file
19
tests/dll/visibility.nim
Normal file
|
|
@ -0,0 +1,19 @@
|
|||
discard """
|
||||
output: "could not import: foo"
|
||||
exitcode: 1
|
||||
"""
|
||||
|
||||
const LibName {.used.} =
|
||||
when defined(windows):
|
||||
"visibility.dll"
|
||||
elif defined(macosx):
|
||||
"libvisibility.dylib"
|
||||
else:
|
||||
"libvisibility.so"
|
||||
|
||||
when compileOption("app", "lib"):
|
||||
proc foo() {.exportc.} =
|
||||
echo "failed"
|
||||
elif isMainModule:
|
||||
proc foo() {.importc, dynlib: LibName.}
|
||||
foo()
|
||||
Loading…
Add table
Add a link
Reference in a new issue