'How can I use a decorated name with _Generic?

I'm writing a library which lets the user decorate the function names like this:

#ifndef DECORATE // Define this before including if you want to change the names.
#define DECORATE(name) lib_##name
#endif

I now what to use _Generic to create a generic function foo like this:

#define DECORATE(foo)(x)            \
    _Generic((x),                   \
             int:   DECORATE(fooi), \
             float: DECORATE(foof)  \
    )(x)

This of course gives me an error, because I can't define the DECORATE macro twice. Is there a way to decorate the name of the generic function or is this impossible?



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source