t10148.nim 626 B

123456789101112131415161718192021222324252627282930
  1. discard """
  2. output: '''Expected successful exit'''
  3. joinable: false
  4. """
  5. import os
  6. proc another_proc: string =
  7. ## trigger many GC allocations
  8. var x = @[""]
  9. for i in 0..100:
  10. x.add $i
  11. result = "not_existent_path"
  12. proc findlib2: string =
  13. let path = getEnv("MYLIB2_DOES_NOT_EXIST_PATH")
  14. let another_path = another_proc()
  15. GC_fullCollect()
  16. if path.len > 0 and dirExists(path):
  17. path / "alib_does_not_matter.dll"
  18. elif fileExists(another_path):
  19. another_path
  20. else:
  21. quit("Expected successful exit", 0)
  22. proc imported_func*(a: cint): cstring {.importc, dynlib: findlib2().}
  23. echo imported_func(0)