inclrtl.nim 1.6 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859
  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 defined(createNimRtl):
  20. when defined(useNimRtl):
  21. {.error: "Cannot create and use nimrtl at the same time!".}
  22. elif appType != "lib":
  23. {.error: "nimrtl must be built as a library!".}
  24. when defined(createNimRtl):
  25. {.pragma: rtl, exportc: "nimrtl_$1", dynlib, gcsafe.}
  26. {.pragma: inl.}
  27. {.pragma: compilerRtl, compilerproc, exportc: "nimrtl_$1", dynlib.}
  28. elif defined(useNimRtl):
  29. when defined(windows):
  30. const nimrtl* = "nimrtl.dll"
  31. elif defined(macosx):
  32. const nimrtl* = "libnimrtl.dylib"
  33. else:
  34. const nimrtl* = "libnimrtl.so"
  35. {.pragma: rtl, importc: "nimrtl_$1", dynlib: nimrtl, gcsafe.}
  36. {.pragma: inl.}
  37. {.pragma: compilerRtl, compilerproc, importc: "nimrtl_$1", dynlib: nimrtl.}
  38. else:
  39. {.pragma: rtl, gcsafe.}
  40. {.pragma: inl, inline.}
  41. {.pragma: compilerRtl, compilerproc.}
  42. when not defined(nimsuperops):
  43. {.pragma: operator.}
  44. when defined(nimlocks):
  45. {.pragma: benign, gcsafe, locks: 0.}
  46. else:
  47. {.pragma: benign, gcsafe.}
  48. when defined(nimTableGet):
  49. {.pragma: deprecatedGet, deprecated.}
  50. else:
  51. {.pragma: deprecatedGet.}