When I try to run the following example I get the error: illegal capture 
'server' because ':anonymous' has the calling convention: <noconv>

How do I make this work?
    
    
    import asynchttpserver, asyncdispatch
    
    proc main() =
      var server = newAsyncHttpServer()
      proc cb(req: Request) {.async.} =
        await req.respond(Http200, "Hello World")
      
      setControlCHook(proc() {.noconv.} =
        echo "Ctrl+C fired!"
        server.close()
        quit(1)
      )
      
      waitFor server.serve(Port(8080), cb)
    
    main()
    
    
    Run

Result of compilation: 
    
    
    $ nim c -r test.nim
    test.nim(10, 5) Error: illegal capture 'server' because ':anonymous' has 
the calling convention: <noconv>
    
    
    Run

Reply via email to