[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Changing entry point function
From: |
Victor Bazarov |
Subject: |
Re: Changing entry point function |
Date: |
Wed, 8 Aug 2007 18:58:08 -0400 |
Premkumar wrote:
> a.cpp
> ----------------------------------
> #include <iostream>
> using namespace std;
>
> void mymain() {
> cout<<"my-main"<<endl;
> }
> ----------------------------------
>
> I'm trying to start my program at mymain than the standard main ..
> So I compiled a.cpp to a.o &
>
> I executed :
> g++ -Wl,-emymain a.o
>
> That did not work as the linker said it could not find the symbol. So
> I used name mangler (nm) to demangle a.o
> g++ -Wl,-emymain__Fv a.o
>
> Now the linker says:
> /usr/lib/crt1.o(.text+0x18): In function `_start':
>> undefined reference to `main'
> collect2: ld returned 1 exit status
>
> I also tried the following
> g++ -Wl,--verbose -Wl,-emymain__Fv -Wl,--defsym -Wl,start=mymain__Fv
> a.o
> g++ -Wl,--verbose -Wl,-emymain__Fv -Wl,--defsym -Wl,_start=mymain__Fv
> a.o
>
> Still no use..
>
> What mistake am I making here ?
Mistake: posting to the wrong newsgroup. Your question is about G++,
so ask it in the G++ newsgroup: gnu.g++.help.
V
--
Please remove capital 'A's when replying by e-mail
I do not respond to top-posted replies, please don't ask