summary refs log tree commit diff stats
path: root/tests
diff options
context:
space:
mode:
authorcooldome <cdome@bk.ru>2018-10-09 14:19:21 +0100
committerAndreas Rumpf <rumpf_a@web.de>2018-10-09 15:19:21 +0200
commit036c52f0b626277970f7173327616e7536d871d1 (patch)
tree9cb51e15132c7401fa170634a0fc9e760aa78128 /tests
parent73e6b229aa6cd99a71fa106e51d3faacfc8b040e (diff)
downloadNim-036c52f0b626277970f7173327616e7536d871d1.tar.gz
fixes #9222 (#9224)
Diffstat (limited to 'tests')
-rw-r--r--tests/cpp/amodule.nim10
-rw-r--r--tests/cpp/t8241.nim16
2 files changed, 26 insertions, 0 deletions
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