Sorry for bringing confusion and for being so unclear with describing the issue.

To understand what I mean let's stick to " **nodecl** " pragma. (we don't need 
to discuss "backticks" or "emit array" because they are serving a different 
purpose.)

Manual says, "It tells Nim that it should not generate a declaration". but in 
fact _it does_ , at least while used inside local scope (in a proc, for 
example).

this works correctly:
    
    
    {.emit:"int i; i = 14;"}
    var i {.nodecl importc}: cint
    echo i
    
    
    Run

put code inside a proc and **nodecl** has no effect:
    
    
    proc getint() =
        {.emit:"int i; i = 14;"}
        var i {.nodecl importc}: cint
        echo i
    
    getint()
    
    
    Run

So, in my opinion the Manual has to be updated like this:

  1. **nodecl** pragma shoud be used only alongside with **importc/importcpp** 
pragma (to make sure name mangling is correct)
  2. **nodecl** pragma works _only_ in global scope.



This can shine light on how things actually work. am I right?

Reply via email to