tdllvar.nim 386 B

12345678910111213141516171819
  1. discard """
  2. disabled: true
  3. """
  4. import os
  5. proc getDllName: string =
  6. result = "mylib.dll"
  7. if fileExists(result): return
  8. result = "mylib2.dll"
  9. if fileExists(result): return
  10. quit("could not load dynamic library")
  11. proc myImport(s: cstring) {.cdecl, importc, dynlib: getDllName().}
  12. proc myImport2(s: int) {.cdecl, importc, dynlib: getDllName().}
  13. myImport("test2")
  14. myImport2(12)