Front page | perl.perl5.porters |
Postings from August 2012
[perl #114516] Win32 Perl declares non-exported externs to XS Modules
From:
bulk 88
Date:
August 20, 2012 13:57
Subject:
[perl #114516] Win32 Perl declares non-exported externs to XS Modules
Message ID:
rt-3.6.HEAD-11172-1345496248-1568.114516-75-0@perl.org
# New Ticket Created by bulk 88
# Please include the string: [perl #114516]
# in the subject line of all future correspondence about this issue.
# <URL: https://rt.perl.org:443/rt3/Ticket/Display.html?id=114516 >
This is a bug report for perl from bulk88@hotmail.com,
generated with the help of perlbug 1.39 running under perl 5.17.3.
-----------------------------------------------------------------
[Please describe your issue here]
Perl is declaring not exported from the Perl interp functions that implement POSIX C lib functions that are not implemented in Windows's native C lib (MS CRT), but these POSIX Perl C Lib replacements are not exported from the Perl library DLL to XS modules, so if a XS module tries to accidentally use one of these, they will get only a link error, instead of a link error and a undefined symbol error from c compiler making them think they forgot got to include a .lib/.a, rather than the function simply doesn't exist.
_________________________________________________________________
#line 216 "c:\\perl517\\lib\\core\\win32.h"
extern uid_t getuid(void);
extern gid_t getgid(void);
extern uid_t geteuid(void);
extern gid_t getegid(void);
extern int setuid(uid_t uid);
extern int setgid(gid_t gid);
extern int kill(int pid, int sig);
extern int killpg(int pid, int sig);
extern void *sbrk(ptrdiff_t need);
#line 280 "c:\\perl517\\lib\\core\\win32.h"
extern char * getlogin(void);
extern int chown(const char *p, uid_t o, gid_t g);
extern int mkstemp(const char *path);
_________________________________________________________________
win32.h winds up being included in every XS module. http://perl5.git.perl.org/perl.git/blob/9567c12e7c38dff57382a52e786cd75941c1ec06:/win32/win32.h#l266 is where the offending declarations are. The Perl C Lib replacement functions live starting at http://perl5.git.perl.org/perl.git/blob/9567c12e7c38dff57382a52e786cd75941c1ec06:/win32/win32.c#l1031 .
As for a fix, I propose either export (I guess probably with Perl_my, my_ or win32_ prefixes) them, or don't declare them in a header that is used by XS modules (place in a non CORE folder header, or ifdef them out in win32.h).
For mkstemp, getuid, killpg and chown I searched mingw's headers, I didn't find it. The others I'm not sure if mingw has them natively, probably not since the code doesn't have a mingw ifdef around it.
For an example of the problem see, http://perlmonks.org/?node_id=988481 .
[Please do not change anything below this line]
-----------------------------------------------------------------
---
Flags:
category=core
severity=low
---
Site configuration information for perl 5.17.3:
Configured by Owner at Sun Aug 19 13:52:24 2012.
Summary of my perl5 (revision 5 version 17 subversion 3 patch blead 2012-08-19.11:53:47 0374b0a2a50c6e91951723a4d9ee1d7f534b03eb v5.17.2-394-g0374b0a) configuration:
Snapshot of: 0374b0a2a50c6e91951723a4d9ee1d7f534b03eb
Platform:
osname=MSWin32, osvers=5.1, archname=MSWin32-x86-multi-thread
uname=''
config_args='undef'
hint=recommended, useposix=true, d_sigaction=undef
useithreads=define, usemultiplicity=define
useperlio=define, d_sfio=undef, uselargefiles=define, usesocks=undef
use64bitint=undef, use64bitall=undef, uselongdouble=undef
usemymalloc=n, bincompat5005=undef
Compiler:
cc='cl', ccflags ='-nologo -GF -W3 -Od -MD -Zi -DDEBUGGING -DWIN32 -D_CONSOLE -DNO_STRICT -DPERL_TEXTMODE_SCRIPTS -DPERL_IMPLICIT_CONTEXT -DPERL_IMPLICIT_SYS -DUSE_PERLIO -D_USE_32BIT_TIME_T',
optimize='-Od -MD -Zi -DDEBUGGING',
cppflags='-DWIN32'
ccversion='13.10.6030', gccversion='', gccosandvers=''
intsize=4, longsize=4, ptrsize=4, doublesize=8, byteorder=1234
d_longlong=undef, longlongsize=8, d_longdbl=define, longdblsize=8
ivtype='long', ivsize=4, nvtype='double', nvsize=8, Off_t='__int64', lseeksize=8
alignbytes=8, prototype=define
Linker and Libraries:
ld='link', ldflags ='-nologo -nodefaultlib -debug -libpath:"c:\perl517\lib\CORE" -machine:x86'
libpth="C:\Program Files\Microsoft Visual Studio .NET 2003\VC7\lib"
libs=oldnames.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib netapi32.lib uuid.lib ws2_32.lib mpr.lib winmm.lib version.lib odbc32.lib odbccp32.lib comctl32.lib msvcrt.lib
perllibs=oldnames.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib netapi32.lib uuid.lib ws2_32.lib mpr.lib winmm.lib version.lib odbc32.lib odbccp32.lib comctl32.lib msvcrt.lib
libc=msvcrt.lib, so=dll, useshrplib=true, libperl=perl517.lib
gnulibc_version=''
Dynamic Linking:
dlsrc=dl_win32.xs, dlext=dll, d_dlsymun=undef, ccdlflags=' '
cccdlflags=' ', lddlflags='-dll -nologo -nodefaultlib -debug -libpath:"c:\perl517\lib\CORE" -machine:x86'
Locally applied patches:
---
@INC for perl 5.17.3:
C:/perl517/site/lib
C:/perl517/lib
.
---
Environment for perl 5.17.3:
HOME (unset)
LANG (unset)
LANGUAGE (unset)
LD_LIBRARY_PATH (unset)
LOGDIR (unset)
PATH=C:\perl517\bin;C:\Program Files\Microsoft Visual Studio .NET 2003\Common7\IDE;C:\Program Files\Microsoft Visual Studio .NET 2003\VC7\BIN;C:\Program Files\Microsoft Visual Studio .NET 2003\Common7\Tools;C:\Program Files\Microsoft Visual Studio .NET 2003\Common7\Tools\bin\prerelease;C:\WINDOWS\system32;C:\WINDOWS;C:\WINDOWS\system32\wbem;
PERL_BADLANG (unset)
SHELL (unset)
-
[perl #114516] Win32 Perl declares non-exported externs to XS Modules
by bulk 88