public inbox for cygwin@cygwin.com
 help / color / mirror / Atom feed
* MinGW's GCC and __attribute__((weak))
@ 2012-09-13  0:03 Andrew Pennebaker
  2012-09-13  3:41 ` Andrew Pennebaker
  0 siblings, 1 reply; 3+ messages in thread
From: Andrew Pennebaker @ 2012-09-13  0:03 UTC (permalink / raw)
  To: Cygwin

Am I correct in assuming that gcc/MinGW builds on top of Cygwin?
Because I'm having trouble getting gcc to recognize
__attribute__((weak)) in Windows, where the exact same C source code
compile just fine with gcc in an ordinary Unix (Mac OS X as it
happens) environment.

I love how you can bundle a framework and CLI in the same Perl script,
by using unless(caller) { main; }. For lack of a better name, I've
started calling this behavior scriptedmain. Here's a Perl script
example (https://github.com/mcandre/scriptedmain/tree/master/perl).

I want to be able to do the same thing in C, and with help from
StackOverflow I've gotten working C code to do just that, in Unix.
Unfortunately, the C code
(http://stackoverflow.com/questions/12395130/trouble-using-scriptedmain-in-mingw)
doesn't compile in Windows, because gcc/MinGW and gcc/Strawberry Perl
fail to recognize __attribute__((weak)) syntax. Is there another way I
can rewrite my code for MinGW's gcc so that it compiles and works like
the Perl scriptedmain? Or can we add __attribute__((weak)) to MinGW's
gcc lexicon?

I will also be asking the Strawberry Perl project about their gcc in
case some minor configuration tweak can get this working.

Cheers,

Andrew Pennebaker
www.yellosoft.us

--
Problem reports:       http://cygwin.com/problems.html
FAQ:                   http://cygwin.com/faq/
Documentation:         http://cygwin.com/docs.html
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: MinGW's GCC and __attribute__((weak))
  2012-09-13  0:03 MinGW's GCC and __attribute__((weak)) Andrew Pennebaker
@ 2012-09-13  3:41 ` Andrew Pennebaker
  2012-09-13  6:29   ` Christopher Faylor
  0 siblings, 1 reply; 3+ messages in thread
From: Andrew Pennebaker @ 2012-09-13  3:41 UTC (permalink / raw)
  To: Cygwin

I found a solution using simple preprocessor instructions.

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

Cheers,

Andrew Pennebaker
www.yellosoft.us

On Wed, Sep 12, 2012 at 5:33 PM, Andrew Pennebaker
<andrew.pennebaker@gmail.com> wrote:
>
> Am I correct in assuming that gcc/MinGW builds on top of Cygwin?
> Because I'm having trouble getting gcc to recognize
> __attribute__((weak)) in Windows, where the exact same C source code
> compile just fine with gcc in an ordinary Unix (Mac OS X as it
> happens) environment.
>
> I love how you can bundle a framework and CLI in the same Perl script,
> by using unless(caller) { main; }. For lack of a better name, I've
> started calling this behavior scriptedmain. Here's a Perl script
> example (https://github.com/mcandre/scriptedmain/tree/master/perl).
>
> I want to be able to do the same thing in C, and with help from
> StackOverflow I've gotten working C code to do just that, in Unix.
> Unfortunately, the C code
> (http://stackoverflow.com/questions/12395130/trouble-using-scriptedmain-in-mingw)
> doesn't compile in Windows, because gcc/MinGW and gcc/Strawberry Perl
> fail to recognize __attribute__((weak)) syntax. Is there another way I
> can rewrite my code for MinGW's gcc so that it compiles and works like
> the Perl scriptedmain? Or can we add __attribute__((weak)) to MinGW's
> gcc lexicon?
>
> I will also be asking the Strawberry Perl project about their gcc in
> case some minor configuration tweak can get this working.
>
> Cheers,
>
> Andrew Pennebaker
> www.yellosoft.us

--
Problem reports:       http://cygwin.com/problems.html
FAQ:                   http://cygwin.com/faq/
Documentation:         http://cygwin.com/docs.html
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: MinGW's GCC and __attribute__((weak))
  2012-09-13  3:41 ` Andrew Pennebaker
@ 2012-09-13  6:29   ` Christopher Faylor
  0 siblings, 0 replies; 3+ messages in thread
From: Christopher Faylor @ 2012-09-13  6:29 UTC (permalink / raw)
  To: cygwin

On Wed, Sep 12, 2012 at 08:40:43PM -0400, Andrew Pennebaker wrote:
>I found a solution using simple preprocessor instructions.
>
>http://stackoverflow.com/a/12397886/350106

FYI, we don't support MinGW here.  MinGW has its own web site.

cgf

--
Problem reports:       http://cygwin.com/problems.html
FAQ:                   http://cygwin.com/faq/
Documentation:         http://cygwin.com/docs.html
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2012-09-13  3:41 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-09-13  0:03 MinGW's GCC and __attribute__((weak)) Andrew Pennebaker
2012-09-13  3:41 ` Andrew Pennebaker
2012-09-13  6:29   ` Christopher Faylor

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).