Hi,
I am not sure about this but i think writting default argument in the macro
might solve your problem. Please give a try to this
#define main(a,b) main(a=0,b=0){
my_Function();
user_main(argc,argv);
}
user_main(a,b)
There might be mistakes in the code i have provided - but i think i have
communicated the idea.
Best Regards,
Ashish Sarode
RAVI <[EMAIL PROTECTED]> wrote:
--- In [email protected], "Paul Herring" <[EMAIL PROTECTED]>
wrote:
>
> On 9/25/07, RAVI <[EMAIL PROTECTED]> wrote:
> > Hello everybody,
> >
> > I am writing an application where I will call my function first before
> > the executing the user's main function.
> > I would like to write my our main function from which the user main
> > function has to be called.
> >
> > i am trying to #define the main function like this:
> >
> > #define main(a,b) main(a,b){
> > my_Function();
> > user_main(argc,argv);
> > }
> > user_main(a,b)
> >
> >
> > This works fine if the user is writing his/her main function as
> > int main(int argc,char *argv[])
> > but what if the user is writng main function as
> > int main()
> > simply without any arguments.
> >
> > How do I #define the user main fuction so that any type of user main
> > function can be replaced .
>
> Your solution is wrong.
>
> Tell your users to write their function to match
>
> int user_function(int, char**)
>
> even if they don't intend to use them, and then you write
>
> int main(int argc, char** argv){
> your_function(argc, argv);
> return user_function(argc, argv);
> }
>
> and don't use the defines at all.
>
>
> --
> PJH
> "Statistics are like a bikini. What they reveal is suggestive, but
> what they conceal is vital"
> -- Aaron Levenstein
>
Thanks for that response.
I can't force my users to write that format of main function.
I am intended to allow them to write the main function in any of the
two possible forms, still I have to achieve my task.
What makes my solution wrong ?
I wanted to see the solution with this approach only.
what makes #defines wrong in my solution?
Can't I find a solution in this way?
--
Ravi.T
---------------------------------
Explore your hobbies and interests. Click here to begin.
[Non-text portions of this message have been removed]