RAVI wrote:
> --- In [email protected], Vic Wagner <[EMAIL PROTECTED]> wrote:
>   
>> RAVI wrote:
>>     
>>> --- In [email protected], "Paul Herring" <pauljherring@> wrote:
>>>   
>>>       
>>>> On 9/25/07, RAVI <rachel_thati@> 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
>>>   
>>>       
>> you haven't said what language you're writing this in, nor what OS 
>> you're using
>>
>>
>> [Non-text portions of this message have been removed]
>>
>>     
>
> C language , gcc compiler, Linux OS.
>
> that's a shame, in C++ it's trivial.
>   



[Non-text portions of this message have been removed]

Reply via email to