the first question, I translated typedef struct tagBookHandle * BookHandle;
to type tagBookHandle* {.final, incompleteStruct, importc: "tagBookHandle".} = object BookHandle* {.importc: "BookHandle".} = ptr tagBookHandle Am I right? But why I get unknown type name 'tagBookHandle' when I compile the following simple code type tagBookHandle* {.final, incompleteStruct, importc: "tagBookHandle".} = object BookHandle* {.importc: "BookHandle".} = ptr tagBookHandle const xldll* = "libxl.dll" # BookHandle xlCreateBookCW(void); proc xlCreateBookCW*(): BookHandle {.cdecl, importc: "xlCreateBookCW", dynlib: xldll.}