-
-
Notifications
You must be signed in to change notification settings - Fork 1.5k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Compile-time usage of parts of strutils fails when using -d:useNimRtl #8405
Comments
Yeah, I know about this problem too, but I fail to see a solution. If you link dynamically, why can we assume the current version is fine for compiletime evaluation? |
Is there a way of fixing something like this with Currently I have a personal project I've been working on that uses a fork of the standard library with the |
Being blocked by this one while modeling a DLL based plugin system. Or: My best guess is some |
Thas has been fixed. |
can we reopen this or add explanations on how this was fixed? The original post still gives compile time error: nim c -r -d:useNimRtl --skipUserCfg --skipParentCfg main.nim
Likewise when using any proc marked with As explained in #10150 (comment), #10150 helps but doesn't quite fix #8405 because there are still unhandled cases of type mappings in The correct fix IMO is to ignore macro rtl(fun: untyped) =
result = fun
let funBody = result[6]
let ret = result[3][0]
let isVoid = ret.kind == nnkEmpty # TODO: handle `void` return, auto etc
let fun0 = $(fun[0])
let fun2 = copy(fun)
fun2[0] = ident"funImpl"
fun2[6] = newEmptyNode()
fun2[4] = newTree(nnkPragma, newTree(nnkExprColonExpr,ident"importc", newLit fun0))
let call = newCall(fun2[0])
for ai in result[3][1..^1]:
call.add ai[0]
let retAux = quote do:
when nimvm:
`funBody`
else:
`fun2`
`call`
result[6] = if isVoid:
newTree(nnkAsgn, ident"result", retAux)
else:
retAux which, when used as follows:
produces:
however, that doesn't work (yet, at least, help welcome), for eg slimmer rtlas mentioned in #8405 (comment), I wonder why rtl isn't limited to just the gc parts instead of additional procs scattered in strutils etc; at the very least there should be an option for a |
…at compile time; CTFFI now works with {dynlib} (#11635)
console output:
Numerous procs in strutils have the same problem, e.g.
contains
andtoUpperASCII
. We should not be trying to link tonimrtl
in matters of compile-time evaluation (as far as most everything in strutils is concerned).The text was updated successfully, but these errors were encountered: