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.

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 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.


Andrew Pennebaker