This is my best shot at generating your C code without codegendecl or emit.
type
Data {.importc: "DATA".} = object
...
Int {.importc: "INT".} = int
String {.importc: "STRING".} = string
proc test1(arg: Data): Data {.exportc: "func_test1", importc:
"func_test1".} # not sure if this is OK to do
proc do_something(arg: Int): String {.importc.}
proc test2(arg: Int): String {.exportc: "func_test2".} =
do_something(arg)
Run
Of course I have no idea what your use case is so this might not be a good
reference at all.