All pastes #815677 Raw Edit

Unnamed

public text v1 · immutable
·published 2007-12-14 08:41 UTC
rendered paste body
// zero terminated list
static char *functionNames[61] = { 0 };

// requires string literal input or static string
static void addFunctionName(const char *name)
{
    functionNames[functionNamesCount++] = name;
    functionNames[functionNamesCount] = 0;
}

#define IMPORT_FUNC(type, func, args) \
    typedef type __stdcall func##_t args; \
    class FuncAdder##func \
    { \
    public: \
        FuncAdder##func()
        {
            addFunctionName(#func);
        }
    };
    static FuncAdder##func funcAdder##func;

IMPORT_FUNC(void, Foo, (int, int))