Re: [arm-gnu] passing variables to main()
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [arm-gnu] passing variables to main()



I renamed the main() to my_main() and changed the call in _start to
"my_main()" but the linker complains:

undefined reference to `my_main()'

JJ

On Wed, Nov 4, 2009 at 2:36 PM, Charles Manning <manningc2@xxxxxxxxxxxxx> wrote:
> On Thursday 05 November 2009 08:34:47 JJ wrote:
>> Hi,
>>
>> I need to pass values to main() when I invoke it from my _start
>> assembly function. I can set the values I want to pass to main in the
>> registers r1, r2, r3 etc. But I cannot create a main() with that takes
>> custom parameters:
>>
>> The compiler does not like:
>> int main(unsigned long long val1, unsigned long long val2, ...)
>>
>> It requires the default main that takes argv, argc:
>> int main(int argc, char *argv)
>>
>> Any suggestions on a better way to pass the values in?
>
> Don't use main() :-)
>
> I use something like MyMain(...) which I can set up to be anything I want.
>
> If the code is portable (ie might also get built as a Linux or PC application)
> then I will set up a main() that then calls MyMain()
>
>
>