handling of compiler procs improved for DLL generation
This commit is contained in:
parent
804e2ac89d
commit
ff02ce2d50
33 changed files with 694 additions and 664 deletions
45
lib/system/inclrtl.nim
Executable file
45
lib/system/inclrtl.nim
Executable file
|
|
@ -0,0 +1,45 @@
|
|||
#
|
||||
#
|
||||
# Nimrod's Runtime Library
|
||||
# (c) Copyright 2010 Andreas Rumpf
|
||||
#
|
||||
# See the file "copying.txt", included in this
|
||||
# distribution, for details about the copyright.
|
||||
#
|
||||
|
||||
## Pragmas for RTL generation. Has to be an include, because user-defined
|
||||
## pragmas cannot be exported.
|
||||
|
||||
# There are 3 different usages:
|
||||
# 1) Ordinary imported code.
|
||||
# 2) Imported from nimrtl.
|
||||
# -> defined(useNimRtl) or appType == "lib" and not defined(createNimRtl)
|
||||
# 3) Exported into nimrtl.
|
||||
# -> appType == "lib" and defined(createNimRtl)
|
||||
|
||||
when defined(createNimRtl):
|
||||
when defined(useNimRtl):
|
||||
{.error: "Cannot create and use nimrtl at the same time!".}
|
||||
elif appType != "lib":
|
||||
{.error: "nimrtl must be build as a library!".}
|
||||
|
||||
when defined(createNimRtl):
|
||||
# NOTE: compilerproc cannot make use of name mangling!
|
||||
{.pragma: rtl, exportc: "nimrtl_$1", dynlib.}
|
||||
{.pragma: inl.}
|
||||
{.pragma: compilerRtl, compilerproc, exportc: "nimrtl_$1", dynlib.}
|
||||
elif defined(useNimRtl):
|
||||
when hostOS == "windows":
|
||||
const nimrtl* = "nimrtl.dll"
|
||||
elif hostOS == "macosx":
|
||||
const nimrtl* = "nimrtl.dynlib"
|
||||
else:
|
||||
const nimrtl* = "libnimrtl.so"
|
||||
{.pragma: rtl, importc: "nimrtl_$1", dynlib: nimrtl.}
|
||||
{.pragma: inl.}
|
||||
{.pragma: compilerRtl, compilerproc, importc: "nimrtl_$1", dynlib: nimrtl.}
|
||||
else:
|
||||
{.pragma: rtl.}
|
||||
{.pragma: inl, inline.}
|
||||
{.pragma: compilerRtl, compilerproc.}
|
||||
|
||||
Loading…
Add table
Add a link
Reference in a new issue