inclrtl.nim 1.7 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364
  1. #
  2. #
  3. # Nim's Runtime Library
  4. # (c) Copyright 2015 Andreas Rumpf
  5. #
  6. # See the file "copying.txt", included in this
  7. # distribution, for details about the copyright.
  8. #
  9. # Pragmas for RTL generation. Has to be an include, because user-defined
  10. # pragmas cannot be exported.
  11. # There are 3 different usages:
  12. # 1) Ordinary imported code.
  13. # 2) Imported from nimrtl.
  14. # -> defined(useNimRtl) or appType == "lib" and not defined(createNimRtl)
  15. # 3) Exported into nimrtl.
  16. # -> appType == "lib" and defined(createNimRtl)
  17. when not defined(nimNewShared):
  18. {.pragma: gcsafe.}
  19. when not defined(nimImmediateDeprecated):
  20. {.pragma: oldimmediate, immediate.}
  21. else:
  22. {.pragma: oldimmediate.}
  23. when defined(createNimRtl):
  24. when defined(useNimRtl):
  25. {.error: "Cannot create and use nimrtl at the same time!".}
  26. elif appType != "lib":
  27. {.error: "nimrtl must be built as a library!".}
  28. when defined(createNimRtl):
  29. {.pragma: rtl, exportc: "nimrtl_$1", dynlib, gcsafe.}
  30. {.pragma: inl.}
  31. {.pragma: compilerRtl, compilerproc, exportc: "nimrtl_$1", dynlib.}
  32. elif defined(useNimRtl):
  33. when defined(windows):
  34. const nimrtl* = "nimrtl.dll"
  35. elif defined(macosx):
  36. const nimrtl* = "libnimrtl.dylib"
  37. else:
  38. const nimrtl* = "libnimrtl.so"
  39. {.pragma: rtl, importc: "nimrtl_$1", dynlib: nimrtl, gcsafe.}
  40. {.pragma: inl.}
  41. {.pragma: compilerRtl, compilerproc, importc: "nimrtl_$1", dynlib: nimrtl.}
  42. else:
  43. {.pragma: rtl, gcsafe.}
  44. {.pragma: inl, inline.}
  45. {.pragma: compilerRtl, compilerproc.}
  46. when not defined(nimsuperops):
  47. {.pragma: operator.}
  48. when defined(nimlocks):
  49. {.pragma: benign, gcsafe, locks: 0.}
  50. else:
  51. {.pragma: benign, gcsafe.}
  52. when defined(nimTableGet):
  53. {.pragma: deprecatedGet, deprecated.}
  54. else:
  55. {.pragma: deprecatedGet.}