Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

[perl #37665] [BUG] compile warning on win32

28 views
Skip to first unread message

Jerry Gay

unread,
Nov 12, 2005, 12:58:49 PM11/12/05
to bugs-bi...@rt.perl.org
# New Ticket Created by jerry gay
# Please include the string: [perl #37665]
# in the subject line of all future correspondence about this issue.
# <URL: https://rt.perl.org/rt3/Ticket/Display.html?id=37665 >


the following output is snipped from parrot's build output with msvc-7.1:

...
classes\env.c
env.c
classes\env.pmc(26) : warning C4273: '__p__environ' : inconsistent dll linkage
D:\usr\local\perl\bin\perl.exe build_tools\pmc2c.pl --c classes\env.pmc
...

normally, i'm able to squash all compiler warnings, but i'm having
trouble tracking this one down. this, by the way, is the *final*
compiler warning with msvc, so the person who fixes this bug gets the
'clean windows' award :)

~jerry

Ron Blaschke

unread,
Nov 17, 2005, 3:58:21 PM11/17/05
to perl6-i...@perl.org
On Sat, 12 Nov 2005 09:58:49 -0800, Jerry Gay wrote:

>
> the following output is snipped from parrot's build output with msvc-7.1:

> classes\env.pmc(26) : warning C4273: '__p__environ' : inconsistent dll linkage


> D:\usr\local\perl\bin\perl.exe build_tools\pmc2c.pl --c classes\env.pmc

> normally, i'm able to squash all compiler warnings, but i'm having


> trouble tracking this one down. this, by the way, is the *final*
> compiler warning with msvc, so the person who fixes this bug gets the
> 'clean windows' award :)

The story goes like this:
classes/env.pmc
extern char **environ;

Vc7/include/stdlib.h
#define environ _environ
#define _environ (*__p__environ())
_CRTIMP char *** __cdecl __p__environ(void);
#define _CRTIMP __declspec(dllimport)

So, F<classes/env.pmc> declares C<environ> without specific linkage,
whereas F<stdlib.h> says it should be imported from a DLL (namely
msvcrt71.dll). Hence the "inconsistent dll linkage" warning.

There are two possible solutions:
1) Don't declare C<environ> in F<classes/env.pmc>
2) "Correctly" declare C<environ> as

_CRTIMP extern char **environ;

Hope this helps,
Ron

Ron Blaschke

unread,
Dec 13, 2005, 4:03:01 PM12/13/05
to jerry gay
jerry gay wrote:
> classes\env.pmc(26) : warning C4273: '__p__environ' : inconsistent dll linkage
> D:\usr\local\perl\bin\perl.exe build_tools\pmc2c.pl --c classes\env.pmc

> normally, i'm able to squash all compiler warnings, but i'm having


> trouble tracking this one down. this, by the way, is the *final*
> compiler warning with msvc, so the person who fixes this bug gets the
> 'clean windows' award :)

Attached patch avoids declaration of environ for MS C compilers, as it
is declared in F<stdlib.h>. This should enable compilation on MSVC
8.0, and avoid the warning on previous versions.

Changed Files:
src/classes/env.pmc

Ron

msvc_ticket_37665.patch

Jerry Gay

unread,
Dec 13, 2005, 4:38:42 PM12/13/05
to Ron Blaschke, jerry gay
thanks, this patch applied cleanly and built without warning on win32-msvc.
also builds and tests clean on i386-linux-gcc. also, since at the time
this bug was filed, this was the last msvc warning, you have earned
the 'clean windows' award.
congrats, ron.

committed as r10508.
~jerry

Ron Blaschke

unread,
Dec 13, 2005, 4:45:38 PM12/13/05
to jerry gay, perl6-i...@perl.org

Great! Thanks Jerry.

Now that the simple stuff is out of the way I can start with more
meaty stuff. env and eval issues are next.

Ron

0 new messages