I have this part of code:
type
tao_Obinded* {.exportc:"tao_Obinded".} = ptr object
tao_Handler* {.exportc:"tao_Handler".} = ptr object
proc libgreattao3_init*(app_name: cstring, args: openarray[cstring]) {.exportc.} =
set_command_line(args)
proc libgreattao3_add_handler* : tao_Handler {.exportc.} =
discard
proc libgreattao3_delete_handler*(a: tao_Handler) {.exportc.} =
discard
proc libgreattao_delete_pathes*(path: cstring) {.exportc.} =
discard
proc libgreattao_obinded_new*(path: cstring) : tao_Obinded {.exportc.} =
discard
And this is my compiler config file:
--app="lib"
--out="./libcommon.so"
--noMain:on
-d:useNimRtl
--header:"libgreattaoV3_exports.h"
--nimcache="./nim_cache"
But the output header looks like:
/* Generated by Nim Compiler v1.2.12 */
/* (c) 2017 Andreas Rumpf */
/* The generated code is subject to the original license. */
#ifndef __libgreattaoV3_exports__
#define __libgreattaoV3_exports__
#define NIM_INTBITS 64
#define NIM_EmulateOverflowChecks
#include "nimbase.h"
#undef LANGUAGE_C
#undef MIPSEB
#undef MIPSEL
#undef PPC
#undef R3000
#undef R4000
#undef i386
#undef linux
#undef mips
#undef near
#undef far
#undef powerpc
#undef unix
typedef struct tyObject_tao_HandlercolonObjectType___E6VSgKDI4NLELBipNW9aOxQ tyObject_tao_HandlercolonObjectType___E6VSgKDI4NLELBipNW9aOxQ;
typedef struct tyObject_tao_ObindedcolonObjectType___9blv5JB9bTUavs9cgi8hYTmww tyObject_tao_ObindedcolonObjectType___9blv5JB9bTUavs9cgi8hYTmww;
N_LIB_PRIVATE N_NIMCALL(NI, getRefcount)(void* p);
N_LIB_PRIVATE N_NIMCALL(void, libgreattao3_init)(NCSTRING app_name, NCSTRING* args, NI argsLen_0);
N_LIB_PRIVATE N_NIMCALL(tyObject_tao_HandlercolonObjectType___E6VSgKDI4NLELBipNW9aOxQ*, libgreattao3_add_handler)(void);
N_LIB_PRIVATE N_NIMCALL(void, libgreattao3_delete_handler)(tyObject_tao_HandlercolonObjectType___E6VSgKDI4NLELBipNW9aOxQ* a);
N_LIB_PRIVATE N_NIMCALL(void, libgreattao_delete_pathes)(NCSTRING path);
N_LIB_PRIVATE N_NIMCALL(tyObject_tao_ObindedcolonObjectType___9blv5JB9bTUavs9cgi8hYTmww*, libgreattao_obinded_new)(NCSTRING path);
N_LIB_IMPORT N_CDECL(void, NimMain)(void);
#endif /* __libgreattaoV3_exports__ */
Problem is: I cannot set type name in C header to looking good for humans/developers.
Try:
type
tao_Obinded* {.exportc:"tao_Obinded".} = object
tao_Handler* {.exportc:"tao_Handler".} = object
And then use the ptr T variant or declare an alias for it.