|
From: Andrea G. <Gal...@ko...> - 2010-10-27 13:10:59
|
I've got a method named OmegaStartup:
void OmegaStartup(void)
{
MemConfig();
mainCRTStartup();
}
and I wanna it to to be the entry point of my application, so I use the
option -e OmegaStartup(void) but the compiler throws the following warning:
c:/mingw/bin/../lib/gcc/mingw32/4.5.0/../../../../mingw32/bin/ld.exe:
warning: cannot find entry symbol OmegaStartup; defaulting to 00401000
To be more specific I'm currently using NetBeans as IDE, so it generates
a make file to build the project.
Does anybody have any idea why it cannot find the entry symbol but the
same function is linked correctly?
|
|
From: Tor L. <tm...@ik...> - 2010-10-27 13:34:26
|
> Does anybody have any idea why it cannot find the entry symbol Try prefixing it with an underscore on the linking command line. At the object file levels, the symbols of C variables and functions using the (default) cdecl calling convention in 32-bit Windows object files are prefixed with an underscore. --tml |
|
From: Andrea G. <gal...@ko...> - 2010-10-28 07:42:26
|
I tried to to replace -e OmegaStartup with -e _OmegaStartup but I've got the same warning: c:/mingw/bin/../lib/gcc/mingw32/4.5.0/../../../../mingw32/bin/ld.exe: warning: cannot find entry symbol _OmegaStartup; defaulting to 00401000 Maybe do I have to use some additional option? Il 27/10/2010 15.33, Tor Lillqvist ha scritto: >> Does anybody have any idea why it cannot find the entry symbol > Try prefixing it with an underscore on the linking command line. At > the object file levels, the symbols of C variables and functions using > the (default) cdecl calling convention in 32-bit Windows object files > are prefixed with an underscore. > > --tml > > ------------------------------------------------------------------------------ > Nokia and AT&T present the 2010 Calling All Innovators-North America contest > Create new apps& games for the Nokia N8 for consumers in U.S. and Canada > $10 million total in prizes - $4M cash, 500 devices, nearly $6M in marketing > Develop with Nokia Qt SDK, Web Runtime, or Java and Publish to Ovi Store > http://p.sf.net/sfu/nokia-dev2dev > _______________________________________________ > MinGW-users mailing list > Min...@li... > > This list observes the Etiquette found at > http://www.mingw.org/Mailing_Lists. > We ask that you be polite and do the same. Disregard for the list etiquette may cause your account to be moderated. > > _______________________________________________ > You may change your MinGW Account Options or unsubscribe at: > https://lists.sourceforge.net/lists/listinfo/mingw-users > > __________ Informazioni da ESET NOD32 Antivirus, versione del database delle firme digitali 5567 (20101027) __________ > > Il messaggio è stato controllato da ESET NOD32 Antivirus. > > www.nod32.it > > > > -- *KORG ITALY SPA* *Via Cagiata, 85 -- 60027 Osimo (AN) - ITALY* *Ph. +39 071 727161 -Fax +39 071 7231228* *P.IVA e Cod. fiscale IT01460580424* *Soggetta al controllo della Società KORG Inc. - Giappone* *Reg. Imprese di n. 212056/1996 del 23/12/96* *REA di Ancona al n. 133105 del 06/12/96* *Capitale sociale Euro 814.253,16 i.v.* Ai sensi del D.Lgs. 30 giugno 2003, n. 196, "Codice in materia di protezione dei dati personali" si precisa che le informazioni contenute nel messaggio sono riservate e destinate esclusivamente alla persona od organizzazione sopra indicata. A chi legge il presente avviso - se non è l'effettivo destinatario, o un dipendente, o la persona responsabile della consegna del messaggio - si notifica che sono proibite copie, distribuzione o divulgazione di quanto in esso contenuto (C.P. 616). Se questo messaggio Vi è pervenuto per errore, Vi preghiamo di informarci immediatamente, di non leggerlo e di distruggerlo. Grazie. /According to Legislative Decree n. 196 of 30 June 2003 about "Personal Data Protection Code" we point out that the information contained in this message may be privileged and confidential and is intended only for the use of the individual entity named above. If the reader of this message is not the intended recipient, or an employee or agent responsible for delivering this message to the intended recipient, you are hereby notified that any dissemination, distribution, or copying of this message is strictly prohibited. If you have received this message in error, please notify us immediately and destroy the original message. //Thank you./ |
|
From: Tor L. <tm...@ik...> - 2010-10-28 08:27:09
|
Your initial mail used the word "method", does that mean you are using C++, and that the entry point you want to use is in fact a method in a class? Hopefully at least a static method, otherwise it wouldn't make any sense, would it? Anyway, using C++ for an entry point sounds like a crazy idea to me. But I am not a C++ person. You might need to use the mangled name then in the linker option, or use extern "C" around your OmegaStartup, or something. But anyway, there might be even more complications if you use C++. (Even if you use just C, various things might break if you try to override the default entry point. You really need to know what you are doing. That you have to ask these questions indicates that you don't.) --tml |
|
From: Andrea G. <gal...@ko...> - 2010-10-28 09:26:00
|
Il 28/10/2010 10.26, Tor Lillqvist ha scritto: > Your initial mail used the word "method", does that mean you are using > C++, and that the entry point you want to use is in fact a method in a > class? Hopefully at least a static method, otherwise it wouldn't make > any sense, would it? Anyway, using C++ for an entry point sounds like > a crazy idea to me. But I am not a C++ person. You might need to use > the mangled name then in the linker option, or use extern "C" around > your OmegaStartup, or something. But anyway, there might be even more > complications if you use C++. (Even if you use just C, various things > might break if you try to override the default entry point. You really > need to know what you are doing. That you have to ask these questions > indicates that you don't.) > > --tml > > ------------------------------------------------------------------------------ > Nokia and AT&T present the 2010 Calling All Innovators-North America contest > Create new apps& games for the Nokia N8 for consumers in U.S. and Canada > $10 million total in prizes - $4M cash, 500 devices, nearly $6M in marketing > Develop with Nokia Qt SDK, Web Runtime, or Java and Publish to Ovi Store > http://p.sf.net/sfu/nokia-dev2dev > _______________________________________________ > MinGW-users mailing list > Min...@li... > > This list observes the Etiquette found at > http://www.mingw.org/Mailing_Lists. > We ask that you be polite and do the same. Disregard for the list etiquette may cause your account to be moderated. > > _______________________________________________ > You may change your MinGW Account Options or unsubscribe at: > https://lists.sourceforge.net/lists/listinfo/mingw-users > > __________ Informazioni da ESET NOD32 Antivirus, versione del database delle firme digitali 5569 (20101027) __________ > > Il messaggio è stato controllato da ESET NOD32 Antivirus. > > www.nod32.it > > > > Even if the project is a c++ project, the OmegaStartup is a very simple C function: extern "C" void MemConfig(void); extern "C" void mainCRTStartup(void); using namespace std; int main(int argc, char* argv[]) { ........ } void OmegaStartup(void) { MemConfig(); mainCRTStartup(); } I need MemConfing to be the first function called, even before the mainCRTStartup(); As you can see I know what I'm doing (this code always worked with MSC compiler and the option /entry: mainCRTStartup), what I actually don't know is how to do the same thing with MinGW. I also noticed that in the object file the symbol for OmegaStartup has become Z12OmegaStartupv; despite on that the option -e Z12OmegaStartupv doesn't work too. I'm sure that something escapes me, I've been struggling with this problem for 2 day... any further help will be appreciate. Thanks |
|
From: Tor L. <tm...@ik...> - 2010-10-28 09:38:56
|
> I also noticed that in the object file the symbol for OmegaStartup has > become Z12OmegaStartupv; despite on that the option -e Z12OmegaStartupv > doesn't work too. Are you sure it isn't __Z12OmegaStartupv ? That's what I see in the object file if I compile the sample code you include. --tml |
|
From: Peter R. <p.r...@sh...> - 2010-10-28 09:41:03
|
On 28/10/2010 10:25, Andrea Galeazzi wrote: > Il 28/10/2010 10.26, Tor Lillqvist ha scritto: >> Your initial mail used the word "method", does that mean you are using >> C++, and that the entry point you want to use is in fact a method in a >> class? Hopefully at least a static method, otherwise it wouldn't make >> any sense, would it? Anyway, using C++ for an entry point sounds like >> a crazy idea to me. But I am not a C++ person. You might need to use >> the mangled name then in the linker option, or use extern "C" around >> your OmegaStartup, or something. But anyway, there might be even more >> complications if you use C++. (Even if you use just C, various things >> might break if you try to override the default entry point. You really >> need to know what you are doing. That you have to ask these questions >> indicates that you don't.) >> >> --tml >> >> ------------------------------------------------------------------------------ >> Nokia and AT&T present the 2010 Calling All Innovators-North America contest >> Create new apps& games for the Nokia N8 for consumers in U.S. and Canada >> $10 million total in prizes - $4M cash, 500 devices, nearly $6M in marketing >> Develop with Nokia Qt SDK, Web Runtime, or Java and Publish to Ovi Store >> http://p.sf.net/sfu/nokia-dev2dev >> _______________________________________________ >> MinGW-users mailing list >> Min...@li... >> >> This list observes the Etiquette found at >> http://www.mingw.org/Mailing_Lists. >> We ask that you be polite and do the same. Disregard for the list etiquette may cause your account to be moderated. >> >> _______________________________________________ >> You may change your MinGW Account Options or unsubscribe at: >> https://lists.sourceforge.net/lists/listinfo/mingw-users >> >> __________ Informazioni da ESET NOD32 Antivirus, versione del database delle firme digitali 5569 (20101027) __________ >> >> Il messaggio è stato controllato da ESET NOD32 Antivirus. >> >> www.nod32.it >> >> >> >> > Even if the project is a c++ project, the OmegaStartup is a very simple > C function: > > extern "C" void MemConfig(void); > extern "C" void mainCRTStartup(void); > using namespace std; > > int main(int argc, char* argv[]) > { > ........ > } > > void OmegaStartup(void) > { > MemConfig(); > mainCRTStartup(); > } > > I need MemConfing to be the first function called, even before the > mainCRTStartup(); > As you can see I know what I'm doing (this code always worked with MSC > compiler and the option /entry: mainCRTStartup), what I actually don't > know is how to do the same thing with MinGW. > I also noticed that in the object file the symbol for OmegaStartup has > become Z12OmegaStartupv; despite on that the option -e Z12OmegaStartupv > doesn't work too. > I'm sure that something escapes me, I've been struggling with this > problem for 2 day... any further help will be appreciate. > Thanks > Just a half-confident suggestion (since I have never had to do it myself) but could you use objdump to trace through the exe? The entry point must be indicated (in the header). What symbol does that take you to? But I have never used objdump... Good luck! Peter |
|
From: Mikko L. <mik...@wi...> - 2010-10-28 12:50:14
|
>Even if the project is a c++ project, the OmegaStartup is a very simple
>C function:
>
>extern "C" void MemConfig(void);
>extern "C" void mainCRTStartup(void);
>using namespace std;
>
>int main(int argc, char* argv[])
>{
>........
>}
>
>void OmegaStartup(void)
>{
> MemConfig();
> mainCRTStartup();
>}
>
>I need MemConfing to be the first function called, even before the
>mainCRTStartup();
>As you can see I know what I'm doing (this code always worked with MSC
>compiler and the option /entry: mainCRTStartup), what I actually don't
>know is how to do the same thing with MinGW.
>I also noticed that in the object file the symbol for OmegaStartup has
>become Z12OmegaStartupv; despite on that the option -e Z12OmegaStartupv
>doesn't work too.
How about
extern "C" void OmegaStartup(void)
{
MemConfig();
mainCRTStartup();
}
and
g++ -e _OmegaStartup .....
BR,
ML
|
|
From: Andrea G. <Gal...@ko...> - 2010-10-28 13:25:07
|
Tor was right, I used g++ -e __Z12OmegaStartupv and it works. Now the question is: do I to inspect the object file in order to know which symbol must be specified to the -e linker option? It sounds me very strange... By the way thanks for the help! |
|
From: Peter R. <p.r...@sh...> - 2010-10-28 13:38:34
|
On 28/10/2010 14:24, Andrea Galeazzi wrote: > Tor was right, I used g++ -e __Z12OmegaStartupv and it works. Now the > question is: do I to inspect the object file in order to know which > symbol must be specified to the -e linker option? It sounds me very > strange... > By the way thanks for the help! > > ------------------------------------------------------------------------------ > Nokia and AT&T present the 2010 Calling All Innovators-North America contest > Create new apps& games for the Nokia N8 for consumers in U.S. and Canada > $10 million total in prizes - $4M cash, 500 devices, nearly $6M in marketing > Develop with Nokia Qt SDK, Web Runtime, or Java and Publish to Ovi Store > http://p.sf.net/sfu/nokia-dev2dev > _______________________________________________ > MinGW-users mailing list > Min...@li... > > This list observes the Etiquette found at > http://www.mingw.org/Mailing_Lists. > We ask that you be polite and do the same. Disregard for the list etiquette may cause your account to be moderated. > > _______________________________________________ > You may change your MinGW Account Options or unsubscribe at: > https://lists.sourceforge.net/lists/listinfo/mingw-users I guess the question may be: If you specify an entry point on the command line as OmegaStartup, how does the compiler know how to mangle that parameter? It could get the 12 (by counting the number of characters). Maybe '__Z' is a conventional prefix (?). But how can it get the 'v' which relates to the argument list (one void type) of the function? I think it's just an information issue... >>do I to inspect the object file in order to know which symbol must be specified to the -e linker option? I suspect you have no option! I am curious: Why do you need to run your own init code? Peter |
|
From: kishor d. <kis...@gm...> - 2010-10-28 10:16:20
|
I was facing the same problem (ld.exe: can not find) that i reinstall the MinGW compiler with proper library files and the problem get solved On Thu, Oct 28, 2010 at 1:12 PM, Andrea Galeazzi <gal...@ko...> wrote: > I tried to to replace -e OmegaStartup with -e _OmegaStartup but I've got the > same warning: > c:/mingw/bin/../lib/gcc/mingw32/4.5.0/../../../../mingw32/bin/ld.exe: > warning: cannot find entry symbol _OmegaStartup; defaulting to 00401000 > Maybe do I have to use some additional option? > > Il 27/10/2010 15.33, Tor Lillqvist ha scritto: > > Does anybody have any idea why it cannot find the entry symbol > > Try prefixing it with an underscore on the linking command line. At > the object file levels, the symbols of C variables and functions using > the (default) cdecl calling convention in 32-bit Windows object files > are prefixed with an underscore. > > --tml > > ------------------------------------------------------------------------------ > Nokia and AT&T present the 2010 Calling All Innovators-North America contest > Create new apps & games for the Nokia N8 for consumers in U.S. and Canada > $10 million total in prizes - $4M cash, 500 devices, nearly $6M in marketing > Develop with Nokia Qt SDK, Web Runtime, or Java and Publish to Ovi Store > http://p.sf.net/sfu/nokia-dev2dev > _______________________________________________ > MinGW-users mailing list > Min...@li... > > This list observes the Etiquette found at > http://www.mingw.org/Mailing_Lists. > We ask that you be polite and do the same. Disregard for the list etiquette > may cause your account to be moderated. > > _______________________________________________ > You may change your MinGW Account Options or unsubscribe at: > https://lists.sourceforge.net/lists/listinfo/mingw-users > > __________ Informazioni da ESET NOD32 Antivirus, versione del database delle > firme digitali 5567 (20101027) __________ > > Il messaggio è stato controllato da ESET NOD32 Antivirus. > > www.nod32.it > > > > > > > -- > > KORG ITALY SPA > > Via Cagiata, 85 – 60027 Osimo (AN) - ITALY > > Ph. +39 071 727161 - Fax +39 071 7231228 > > P.IVA e Cod. fiscale IT01460580424 > > Soggetta al controllo della Società KORG Inc. - Giappone > > Reg. Imprese di n. 212056/1996 del 23/12/96 > > REA di Ancona al n. 133105 del 06/12/96 > > Capitale sociale Euro 814.253,16 i.v. > > > > > > > > Ai sensi del D.Lgs. 30 giugno 2003, n. 196, “Codice in materia di protezione > dei dati personali” si precisa che le informazioni contenute nel messaggio > sono riservate e destinate esclusivamente alla persona od organizzazione > sopra indicata. A chi legge il presente avviso - se non è l'effettivo > destinatario, o un dipendente, o la persona responsabile della consegna del > messaggio - si notifica che sono proibite copie, distribuzione o > divulgazione di quanto in esso contenuto (C.P. 616). Se questo messaggio Vi > è pervenuto per errore, Vi preghiamo di informarci immediatamente, di non > leggerlo e di distruggerlo. Grazie. > > > > According to Legislative Decree n. 196 of 30 June 2003 about “Personal Data > Protection Code” we point out that the information contained in this message > may be privileged and confidential and is intended only for the use of the > individual entity named above. If the reader of this message is not the > intended recipient, or an employee or agent responsible for delivering this > message to the intended recipient, you are hereby notified that any > dissemination, distribution, or copying of this message is strictly > prohibited. If you have received this message in error, please notify us > immediately and destroy the original message. Thank you. > > > > > > ------------------------------------------------------------------------------ > Nokia and AT&T present the 2010 Calling All Innovators-North America contest > Create new apps & games for the Nokia N8 for consumers in U.S. and Canada > $10 million total in prizes - $4M cash, 500 devices, nearly $6M in marketing > Develop with Nokia Qt SDK, Web Runtime, or Java and Publish to Ovi Store > http://p.sf.net/sfu/nokia-dev2dev > _______________________________________________ > MinGW-users mailing list > Min...@li... > > This list observes the Etiquette found at > http://www.mingw.org/Mailing_Lists. > We ask that you be polite and do the same. Disregard for the list etiquette > may cause your account to be moderated. > > _______________________________________________ > You may change your MinGW Account Options or unsubscribe at: > https://lists.sourceforge.net/lists/listinfo/mingw-users > -- Warm Regards, Kishore Deotale Consultant/Software Developer Agogue Consultancy Services Pvt Ltd. Baner, Pune, India PH:020-67246464 Cell:9325080005 09579516245 |
|
From: Greg C. <gch...@sb...> - 2010-10-28 15:09:18
|
On 2010-10-28 13:24Z, Andrea Galeazzi wrote: > Tor was right, I used g++ -e __Z12OmegaStartupv and it works. Now the > question is: do I to inspect the object file in order to know which > symbol must be specified to the -e linker option? It sounds me very > strange... '__Z12OmegaStartupv' is a "mangled" name. C++ functions can be overloaded, e.g.: void f(); int f(char *); The C++ compiler can figure out which one to call in any context, but those two functions must have different names in the object file--they can't both be called simply 'f'--so their signatures are encoded into "mangled" names. All C++ compilers do this. And they deliberately do it in mutually incompatible ways, for safety: http://www.mingw.org/wiki/MixingCompilers Even different versions of the same compiler may treat mangling differently. In situations like yours, it would be easier and more robust to have one simple name. That's why C++ provides 'extern "C"'. If you write extern "C" void f(); then f()'s name will not be "mangled"--it will be the same name that the compiler would use for this function: void f(void); in a C program. That name is '_f', prefixed with '_' because that's the normal convention for C linkage, for all compilers on this platform. |
|
From: Douglas A. <kb...@gm...> - 2010-10-28 15:30:21
|
Here's my two cents on the matter. Some of us could use a little information on the exact headers for the functions that you describe here. What libs are you using that you linked in MSC? Now what libs are from MinGW? A little more detail may benefit us as well for enlightenment of what you are trying to accomplish. Thanks! P.S. Can you do a similar process on a linux/unix machine? (the whole point of MinGW) |