Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

close #19380; add testcase #20413

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
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
4 changes: 4 additions & 0 deletions tests/misc/m19380.nim
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
proc add*(a, b: int): int {.cdecl, exportc.} =
a + b
proc sub*(a, b: int): int {.cdecl, exportc.} =
a - b
11 changes: 11 additions & 0 deletions tests/misc/m19380_main.nim
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
import stdtest/specialpaths
import std/os

const buildLib = buildDir / "libD20220923T19380"

{.passL: buildLib.}
proc add*(a, b: int):int {.cdecl, importc.}
proc sub*(a, b: int):int {.cdecl, importc.}

echo add(10, 5)
echo sub(10, 5)
22 changes: 22 additions & 0 deletions tests/misc/t19380.nim
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
discard """
joinable: false
"""

import stdtest/specialpaths
import std/[osproc, strformat, os]

const
nim = getCurrentCompilerExe()
buildLib = buildDir / "libD20220923T19380"
currentDir = splitFile(currentSourcePath).dir
file = currentDir / "m19380.nim"
main = currentDir / "m19380_main.nim"


proc runCmd(cmd: string) =
let (msg, code) = execCmdEx(cmd)
doAssert code == 0, msg


runCmd fmt"{nim} c -o:{buildLib} --nomain --nimMainPrefix:libA -f --app:staticlib {file}"
runCmd fmt"{nim} c -r {main}"