C identifier restrictions
How do I call a malformed character from C?
module.name:version
void* function(TypeSig); // Type of the function
I would like to be able to use coded notations written in my language in C. The function calling convention is roughly the same. It's just that I have to mangle the version and module path inside the exported symbols and I have the same identifier convention as C, so I can't just use underscore.
source to share
IIUC, you define your own language and look for a suitable naming algorithm.
You might want to use Intel et.al. The Itanium name lookup algorithm that g ++ uses on all platforms. In a specific case, you can mangle each of your names as if the C ++ declaration were
namespace module{ namespace name { namespace Vversion /*e.g. V1_0 */ {
void *function(int){}
}}}
which will cripple like
_ZN6module4name4V1_08functionEi
Since all of your symbols use this algorithm, they cannot conflict with each other. They also cannot contradict the standard C function called _ZN6module4name4V1_08functionEi
as all names beginning with _Z (or, _UPPERCASE) are reserved for the implementation (from C). If you want a convenient callability from g ++, you can use this exact convention; otherwise, you choose a letter other than Z.
source to share