top button
Flag Notify
    Connect to us
      Facebook Login
      Site Registration Why to Join

Facebook Login
Site Registration

C: What is wrapper function and how it is written in C language ?

0 votes
63 views
C: What is wrapper function and how it is written in C language ?
posted Jul 15, 2017 by Vikram Singh

Share this question
Facebook Share Button Twitter Share Button Google+ Share Button LinkedIn Share Button Multiple Social Share Button

1 Answer

0 votes

Wrapper function gives you flexibility add extra functionality before or after execution of actual function.
Using macro it is written

define WRAPPER(fun, arg1, arg2) \

{\
ret = fun(arg1, arg2);\
return (ret); \
}

In case later on if prototype is changed for fun, it starts taking three arguments you have to change this MACRO definition.
In all places where it is called you don't need to change.

define WRAPPER(fun, arg1, arg2) \

{\
int arg3;\
ret = fun(arg1, arg2, arg3);\
return (ret); \
}

For end user it is still same number of arguments that need to be passed through WRAPPER.

answer Jul 18, 2017 by Harshita
Contact Us
+91 9880187415
sales@queryhome.net
support@queryhome.net
#280, 3rd floor, 5th Main
6th Sector, HSR Layout
Bangalore-560102
Karnataka INDIA.
QUERY HOME
...