top button
Flag Notify
    Connect to us
      Facebook Login
      Site Registration

Facebook Login
Site Registration

How to rename a function in C at runtime or compile time?

+4 votes
How to rename a function in C at runtime or compile time?
posted Apr 29, 2016 by anonymous

Share this question
Facebook Share Button Twitter Share Button LinkedIn Share Button

3 Answers

+3 votes
Best answer

use preprocessor like

#define FunctionName() newFunctionName()

and there is no other way.

answer Apr 29, 2016 by Shivam Kumar Pandey
thanks for selecting as best ans.
+1 vote
Using help of macros. You can do this.
answer Apr 30, 2016 by Rajan Paswan
+1 vote

If you are looking a function to be identified with two names then try typedef.
If want to change the name permanently then use macro as Shivam suggested.

answer Apr 30, 2016 by Salil Agrawal
Similar Questions
+2 votes

I assume that constant must be initialized to a constant value at compile time, but following code the return value of ge_const() is assigned to x which will be collected at run time. So this must cause an error but I am getting the output as 50. Can someone clarify the detail?

    const int x = get_const();
    printf("%d", x);
int get_const()
    return 50;
+2 votes

Let's say I have an exe-file (for example computer game) and need to forbid to run it until certain date or time during the day. Any 'manipulations' with file are allowed.

Could you, please, offer me a simple way of how to encode/decode such a file mostly in C or C++?

Contact Us
+91 9880187415
#280, 3rd floor, 5th Main
6th Sector, HSR Layout
Karnataka INDIA.