From 036c52f0b626277970f7173327616e7536d871d1 Mon Sep 17 00:00:00 2001 From: cooldome Date: Tue, 9 Oct 2018 14:19:21 +0100 Subject: fixes #9222 (#9224) --- tests/cpp/amodule.nim | 10 ++++++++++ tests/cpp/t8241.nim | 16 ++++++++++++++++ 2 files changed, 26 insertions(+) create mode 100644 tests/cpp/amodule.nim (limited to 'tests') diff --git a/tests/cpp/amodule.nim b/tests/cpp/amodule.nim new file mode 100644 index 000000000..2f3e34051 --- /dev/null +++ b/tests/cpp/amodule.nim @@ -0,0 +1,10 @@ +import os + +proc findlib: string = + let path = getEnv("MYLIB_DOES_NOT_EXIST_PATH") + if path.len > 0 and dirExists(path): + path / "alib_does_not_matter.dll" + else: + "alib_does_not_matter.dll" + +proc imported_func*(a: cint): cstring {.importc, dynlib: findlib().} \ No newline at end of file diff --git a/tests/cpp/t8241.nim b/tests/cpp/t8241.nim index 8e98fda10..cbee1d85a 100644 --- a/tests/cpp/t8241.nim +++ b/tests/cpp/t8241.nim @@ -5,3 +5,19 @@ discard """ proc foo(): cstring {.importcpp: "", dynlib: "".} echo foo() + + +## bug #9222 +import os +import amodule +proc findlib2: string = + let path = getEnv("MYLIB2_DOES_NOT_EXIST_PATH") + if path.len > 0 and dirExists(path): + path / "alib_does_not_matter.dll" + else: + "alib_does_not_matter.dll" + +proc imported_func2*(a: cint): cstring {.importc, dynlib: findlib2().} + +echo imported_func(1) +echo imported_func2(1) \ No newline at end of file -- cgit 1.4.1-2-gfad0