From: Khalid A. Bakr <khabkr@ya...> - 2009-02-06 12:31:15
>> A VC project requires an external main (as in extern int main) and makes the following pragma definition:
>> #pragma comment(linker,"/ENTRY:wmainCRTStartup")
>> Is it possible to do (build) that in MinGW? And how? Any pointers/examples appreciated.
> You can build that, but you won't be able to set that linker option
> via source code; you'll have to edit the makefile to add a command
> line option with the same effect as the MSVC extension the code relies
> If invoking GNU LD directly:
> ld [options] -e wmainCRTStartup [objects] [libs]
> If invoking GNU LD through GCC:
> gcc [options] -Wl,-e,wmainCRTStartup [objects] [libs]
> (The "-e" option is prefix by "Wl (uppercase double-u, lowercase el)".
> And yes, commas in place of spaces.)
> Besides, this will skip any initialization routines specific to MinGW,
> though this will probably make no difference, considering the program
> isn't MingW-aware.
> Hope this helps.
Thank you CS. Truly appreciate the help.
Is there is a list of such (or other) GCC (and LD) options that one can refer to? Or is the manual the only authority on this matter?
2009/2/6 Khalid A. Bakr <khabkr@...>:
> Is there is a list of such (or other) GCC (and LD) options that one can refer to? Or is the manual the only authority on this matter?
Sure. Gcc (the compiler and linker driver - gcc.exe), if invoked with
--help -v will execute all of its driven programs (as, ld, and cc1 -
the actual C compiler) with the --help option.
A suggested way of invoking is:
$ gcc --help -v > gccoptions.txt 2>&1
This will create a file gccoptions.txt with all of the features
implemented by the gcc version that was invoked. I use that as a first
reference when I'm seeking to alter default gcc behavior. Of course
the descriptions aren't any verbose, so you'll often end up looking on
the Internet, but this will often give you something to start with.