I think you can't use closure function. Instead you should use global variables.
<https://github.com/planety/prologue/blob/d588f926ae0d103978aecb6038b1c92f2d4659a6/src/prologue/core/application.nim#L67> <https://github.com/planety/prologue/blob/d588f926ae0d103978aecb6038b1c92f2d4659a6/src/prologue/core/application.nim#L355>