I actually found the solution by myself: # Note: extremely unsafe code, assumes that this is running on a 64-bit machine # 16 byte should be used for closures var procedures: seq[array[8, byte]] = @[] procedures.add(cast[array[8, byte]](greet)) procedures.add(cast[array[8, byte]](someotherproc)) # It does compile and work without the nimcall pragma, but I let it there, safety first cast[proc(msg: string) {.nimcall.}](procedures[0])("Hallo Welt") cast[proc(){.nimcall.}](procedures[1])()
Also procedures has to be a var instead of let, ah I'm so depending on auto linting. Atleast I learned something while breaking Nim. Breaking the rules is something which is only rarely taught(for good reasons). But I'm glad that it's possible in Nim.