filcuc / nimqml

Qt Qml bindings for the Nim programming language
Other
164 stars 20 forks source link

Make getDllName() return a compile-time constant string. #9

Closed markus-oberhumer closed 7 years ago

ghost commented 7 years ago

I would remove the template and instead refer to the constant directly.

filcuc commented 7 years ago

As @ephja said remove the the template and simply use the const name inside the dynlib pragma. While doing this i would name the const variable as dynLibName

markus-oberhumer commented 7 years ago

Well, my proposed commit is simple and just works - without touching the 100+ calls of getDllName().

filcuc commented 7 years ago

@markus-oberhumer and what's the problem in touching the 100+ calls? if you're not willing to do this i can do it for you (implies closing this pull)

markus-oberhumer commented 7 years ago

@filcuc Of course I can provide a follow-up commit after merging this pull request.

ghost commented 7 years ago

Btw, the original code works because the compile time property of a proc can be inferred without annotating it with {.compileTime.}, so that makes it very similar to a const if the proc doesn't have any side effects. You can do a lot of things at compile time.

markus-oberhumer commented 7 years ago

No, the current version does not work as you think - just have a look at the generated C code.

And then try using nim c --dynlibOverride:libDOtherSide.so.0.6 with both the current and my patched version.

ghost commented 7 years ago

Oh I see. I wonder why that is. I'll investigate.

filcuc commented 7 years ago

Fixed in master