Forums
New posts
Search forums
Members
Current visitors
Log in
Register
What's new
Search
Search
Search titles only
By:
New posts
Search forums
Menu
Log in
Register
Install the app
Install
Forums
Archive
Archive
C Programming
Prepend name to function names?
JavaScript is disabled. For a better experience, please enable JavaScript in your browser before proceeding.
You are using an out of date browser. It may not display this or other websites correctly.
You should upgrade or use an
alternative browser
.
Reply to thread
Message
[QUOTE="dspfun, post: 3423360"] I was asked whether it is possible to prepend a name (using macro substitution) to all function names in a file/program. For example, the functions f1(), f2(), f3() should get aa_ prepended to their names? I.e., f1(), f2(), f3() should be changed to aa_f1(), aa_f2(), aa_f3() using some macro substitution. I came up with the following: **************************************************** #include <stdio.h> #define PREPEND aa_ #define MAKE_FUNC_NAME(prepend, func_name) prepend ## func_name void MAKE_FUNC_NAME(PREPEND, f1)(void) { printf("here..\n"); } **************************************************** However, this does not define the function aa_f1, instead the function PREPENDf1 is defined. Why? Is there some way to get around this to achieve what is set out to be done? [/QUOTE]
Verification
Post reply
Forums
Archive
Archive
C Programming
Prepend name to function names?
Top