How do you handle typedefs that define a function type?

JeffDJeffD Posts: 20

I've been running into a lot of these in a library I'm experimenting with and it's pretty clear that Kludge currently doesn't understand this flavor of typedef.
Is there a way to wrap these manually or is this something that's not unsupported by kl?

UPDATE: Per this post;
they most likely aren't supported, because even though a function type is not a function, you assign user defined functions to them by using function-pointers.


If interested here's a pseudo code example (Based on a true story :))


typedef void aCallback(void *data, aObj o1, aObj o2);

discover's output

ext.add_alias('aCallback', 'void (void *, aObj, aObj)')

generate's warning message

Warning: Ignoring alias 'aCallback': void (void *, aObj, aObj): unhandled C++ type expression (details: Expected end of text (at char 5), (line:1, col:6))


  • malbrechtmalbrecht Fabric for Houdini Posts: 752 ✭✭✭

    Moin, Jeff,

    I haven't looked deeper into it, but on a short glance, the typedef you are quoting looks malformed to me. Note: I have only been using C/C++ for a few days over the last couple of years, most of my development takes place before the actual code writing, so things may have changed since I learned this (read: I may be wrong ;) ).

    typedefs - in my understanding - tell the compiler how the (later defined) function works, what parameters go to the stack and what are transferred as pointers. This is necessary especially when dealing with external libraries (DLL), since the compiler may never actually read the function called, so it needs to know how to prepare the subroutine call.
    However, the definition does not define variable names (which is what your definition tries to do). It is possible that Kludge misinterprets the existence of variable names as the actual function definition (we called this a "stub" back in the days).

    Have you tried using typedefs without variable names? Like

    typedef void aCallback(void *, aObj, aObj);


    Marc Albrecht - - does things.

  • JeffDJeffD Posts: 20

    Hi @malbrecht ,

    This library isn't code I've written, but it is open source, so I gave your suggestion a try. (After finishing some other things, hence the delay in responding)

    Unfortunately the result is exactly same. I was pretty sure it would be, discover just doesn't understand this kind of typedef (but the change logs for the newer Escher builds show some work in that area so this might be changing :) )


Sign In or Register to comment.