I am building a package (samtools if anyone cares) that tries to define some functions with c preprocessor macro expansions. In doing so it uses type names (e.g., uint16_t) as both part of the function name as well as one of the types within the function definition. However, in some but not all places the macro expansion leads to extra underscores being prepended, i.e., uint16_t is sometimes expanded as __uint16_t.
This is clearly a result of lines like the following in <sys/types.h>:
The problem is that the extra underscores that are added to the function names do not match function calls elsewhere without them.
Here is a much simplified example. Running the following through gcc -E
yields the following (omitting all the stuff from sys/types.h):
I would appreciate some input from the c preprocessor wizards among you regarding how to fix this problem.
Thanks for your help.