mirror of
https://github.com/nim-lang/Nim.git
synced 2025-12-28 08:54:53 +00:00
4
tests/misc/m15955.nim
Normal file
4
tests/misc/m15955.nim
Normal file
@@ -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
tests/misc/m15955_main.nim
Normal file
11
tests/misc/m15955_main.nim
Normal file
@@ -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
tests/misc/t15955.nim
Normal file
22
tests/misc/t15955.nim
Normal file
@@ -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 / "m15955.nim"
|
||||
main = currentDir / "m15955_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}"
|
||||
Reference in New Issue
Block a user