I found a solution for hiding main() that works in Windows and Unix, using simple preprocessor instructions.

http://stackoverflow.com/a/12397886/350106

Cheers,

Andrew Pennebaker
www.yellosoft.us

On Wed, Sep 12, 2012 at 7:16 PM, Andrew Pennebaker <andrew.pennebaker@gmail.com> wrote:
I'm not compiling to ELF; I'm using GCC in Windows to compile to a Windows PXE, an exe binary executable file. Is there a way to effectively duplicate __attribute__((weak)) when compiling to a Windows executable?

Cheers,

Andrew Pennebaker
www.yellosoft.us

On Wed, Sep 12, 2012 at 6:17 PM, LRN <lrn1986@gmail.com> wrote:
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

On 13.09.2012 1:58, Andrew Pennebaker wrote:
> Thanks for supplying a hyperlink to __attribute__ documentation,
> but how does that answer my question?
>
> I try using combinations of #pragma weak, _Pragma weak, and
> __declspec(weak) to achieve the same effect as
> __attribute__((weak)) with GCC/MinGW in Windows, but none of them
> compile.
>
Let me quote contents of that page then:
weak
    The weak attribute causes the declaration to be emitted as a weak
symbol rather than a global. This is primarily useful in defining
library functions which can be overridden in user code, though it can
also be used with non-function declarations. Weak symbols *are
supported for ELF targets, and also for a.out targets when using the
GNU assembler and linker*.

Now, are you compiling to ELF or a.out?
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.11 (MingW32)
Comment: Using GnuPG with Mozilla - http://www.enigmail.net/

iQEcBAEBAgAGBQJQUQoAAAoJEOs4Jb6SI2CwtNUIAJFdolKPXjHxiKePQo4pOdHR
BI/X38zd38oWY5xFfj65tMBcpiazYcvQfXSgVl+0Szuuv7hGsup7CLqv0a5BfjSc
Tou7PYOWglnboN1NvodrZ+7KMrwj8FkkmNmt8CRNpjWE1kZUrirsZYyC6bSlo88U
ZAav3n/h6hxYYjvbnA13UsEg3L1kLZN9qKhcU8+U0AJh4KCbnULEJQwnOu6dg1Lu
OUzet/RjwuDEiUSzFw96TruvDlXIKdcXtkvlDGt7nRtFmkd3M9+U0Cqr5/M8EsSV
G6yG97ghJTngk3WRs/rW8FwB0dVhdzUsNMoTr/95fwk6sKbGH6L0tnhBZ+ksQdY=
=xcjf
-----END PGP SIGNATURE-----

------------------------------------------------------------------------------
Live Security Virtual Conference
Exclusive live event will cover all the ways today's security and
threat landscape has changed and how IT managers can respond. Discussions
will include endpoint security, mobile security and the latest in malware
threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/
_______________________________________________
MinGW-users mailing list
MinGW-users@lists.sourceforge.net

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
Also: mailto:mingw-users-request@lists.sourceforge.net?subject=unsubscribe