#pragma :wmainCRTStartup

classic Classic list List threaded Threaded
4 messages Options
Reply | Threaded
Open this post in threaded view
|

#pragma :wmainCRTStartup

Khalid A. Bakr
Hello.

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.


Regards



     

------------------------------------------------------------------------------
This SF.net email is sponsored by:
SourcForge Community
SourceForge wants to tell your story.
http://p.sf.net/sfu/sf-spreadtheword
_______________________________________________
MinGW-users mailing list
[hidden email]

You may change your MinGW Account Options or unsubscribe at:
https://lists.sourceforge.net/lists/listinfo/mingw-users

_______________________________________________
This list observes the Etiquette found at
http://www.mingw.org/Mailing_Lists.
We ask that you be polite and do the same.

Most annoying abuses are:
1) Top posting
2) HTML/MIME encoded mail
3) Improper quoting
4) Improper trimming
Reply | Threaded
Open this post in threaded view
|

Re: #pragma :wmainCRTStartup

ColdShine
2009/2/1 Khalid A. Bakr <[hidden email]>:
> Hello.
>
> 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
upon.

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.

--
CS

------------------------------------------------------------------------------
Create and Deploy Rich Internet Apps outside the browser with Adobe(R)AIR(TM)
software. With Adobe AIR, Ajax developers can use existing skills and code to
build responsive, highly engaging applications that combine the power of local
resources and data with the reach of the web. Download the Adobe AIR SDK and
Ajax docs to start building applications today-http://p.sf.net/sfu/adobe-com
_______________________________________________
MinGW-users mailing list
[hidden email]

You may change your MinGW Account Options or unsubscribe at:
https://lists.sourceforge.net/lists/listinfo/mingw-users

_______________________________________________
This list observes the Etiquette found at
http://www.mingw.org/Mailing_Lists.
We ask that you be polite and do the same.

Most annoying abuses are:
1) Top posting
2) HTML/MIME encoded mail
3) Improper quoting
4) Improper trimming
Reply | Threaded
Open this post in threaded view
|

Re: #pragma :wmainCRTStartup

Khalid A. Bakr
In reply to this post by Khalid A. Bakr
>> Hello.
>>
>> 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
> upon.
>
> 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.
>
> --
> CS


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?

Regards



     

------------------------------------------------------------------------------
Create and Deploy Rich Internet Apps outside the browser with Adobe(R)AIR(TM)
software. With Adobe AIR, Ajax developers can use existing skills and code to
build responsive, highly engaging applications that combine the power of local
resources and data with the reach of the web. Download the Adobe AIR SDK and
Ajax docs to start building applications today-http://p.sf.net/sfu/adobe-com
_______________________________________________
MinGW-users mailing list
[hidden email]

You may change your MinGW Account Options or unsubscribe at:
https://lists.sourceforge.net/lists/listinfo/mingw-users

_______________________________________________
This list observes the Etiquette found at
http://www.mingw.org/Mailing_Lists.
We ask that you be polite and do the same.

Most annoying abuses are:
1) Top posting
2) HTML/MIME encoded mail
3) Improper quoting
4) Improper trimming
Reply | Threaded
Open this post in threaded view
|

Re: #pragma :wmainCRTStartup

ColdShine
2009/2/6 Khalid A. Bakr <[hidden email]>:
> 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.

--
CS

------------------------------------------------------------------------------
Create and Deploy Rich Internet Apps outside the browser with Adobe(R)AIR(TM)
software. With Adobe AIR, Ajax developers can use existing skills and code to
build responsive, highly engaging applications that combine the power of local
resources and data with the reach of the web. Download the Adobe AIR SDK and
Ajax docs to start building applications today-http://p.sf.net/sfu/adobe-com
_______________________________________________
MinGW-users mailing list
[hidden email]

You may change your MinGW Account Options or unsubscribe at:
https://lists.sourceforge.net/lists/listinfo/mingw-users

_______________________________________________
This list observes the Etiquette found at
http://www.mingw.org/Mailing_Lists.
We ask that you be polite and do the same.

Most annoying abuses are:
1) Top posting
2) HTML/MIME encoded mail
3) Improper quoting
4) Improper trimming