C callbacks?

Chris Andrews CodexArcanum at gmail.com
Wed Mar 18 11:13:29 PDT 2009


I've hit another snag on my C library interfacing.  The .h defines a function:

//typedef bool (*TCOD_bsp_callback_t)(TCOD_bsp_t *node, void *userData);
bool* bsp_callback_t(bsp_t* node, void* userData); //bsp_t is a struct defining the bsp tree

Sidenote: Did I translate that right?

Anyway, this function is later passed into various functions, like:

bool bsp_traverse_pre_order(bsp_t *node, bsp_callback_t listener, void *userData);


I've tried doing some reading on this board regarding c callbacks and delegates, but it feels a bit over my head.  Can anyone assist me in figuring out how to D-ify this bit of code so I can interact with the C dll?


More information about the Digitalmars-d-learn mailing list