develooper Front page | perl.perl5.porters | Postings from February 2013

[rt.cpan.org #83154] commit "Fix failing Time-Piece tests on Win32" is not WinCE compatible

From:
Daniel Dragan via RT
Date:
February 6, 2013 09:58
Subject:
[rt.cpan.org #83154] commit "Fix failing Time-Piece tests on Win32" is not WinCE compatible
Message ID:
rt-3.8.HEAD-5931-1360144653-1382.83154-17-0@rt.cpan.org
<URL: https://rt.cpan.org/Ticket/Display.html?id=83154 >

http://perl5.git.perl.org/perl.git/commit/6e0733998eff7a098d2d21d5602f3eb2a7521e1f?f=cpan/Time-Piece/Piece.xs
This commit undefed getenv and putenv. On WinCE most of the clib is
macro defined to "xce" clib versions (these are exported dll functions)
provided by the 3rd party celib library (it provides a console/normal
clib experience).

____________________________________________________________________
        ..\..\miniperl.exe "-I..\..\lib"
"-I..\..\xlib\wince-x86-hpc-wce300" -ME
xtUtils::Mksymlists  -e "Mksymlists('NAME'=>\"Time::Piece\", 'DLBASE' =>
'Piece'
, 'DL_FUNCS' => {  }, 'FUNCLIST' => [], 'IMPORTS' => {  }, 'DL_VARS' =>
[]);"
        link
-out:..\..\xlib\wince-x86-hpc-wce300\auto\Time\Piece\Piece.dll -dll
 -libpath:C:\sources\celib-palm-3.0\wince-x86-hpc-wce300-release -nologo
-opt:re
f,icf -machine:X86 -debug -subsystem:windowsce,2.0 Piece.obj  
..\..\xlib\wince-
x86-hpc-wce300\CORE\..\..\..\xlib\wince-x86-hpc-wce300\CORE\perl517.lib
-nodefau
ltlib  ws2.lib celib.lib coredll.lib corelibc.lib -def:Piece.def
   Creating library
..\..\xlib\wince-x86-hpc-wce300\auto\Time\Piece\Piece.lib an
d object ..\..\xlib\wince-x86-hpc-wce300\auto\Time\Piece\Piece.exp
Piece.obj : error LNK2019: unresolved external symbol _putenv referenced
in func
tion _fix_win32_tzenv
Piece.obj : error LNK2019: unresolved external symbol _getenv referenced
in func
tion _fix_win32_tzenv
..\..\xlib\wince-x86-hpc-wce300\auto\Time\Piece\Piece.dll : fatal error
LNK1120:
 2 unresolved externals
NMAKE : fatal error U1077: 'link' : return code '0x460'
Stop.
Unsuccessful make(cpan/Time-Piece): code=512 at ..\make_ext.pl line 494.
NMAKE : fatal error U1077: 'C:\p517\ce\win32\..\miniperl.exe' : return
code '0x2
'
Stop.

C:\p517\ce\win32>
________________________________________________________________

Unlike Desktop Win32 Perl, where win32_getenv is a complex function call
that ultimately calls GetEnvironmentVariableA, in WinCE Perl
win32_getenv calls xcegetenv (the clib getenv on WinCE) with no logic
http://perl5.git.perl.org/perl.git/blob/a820780c62918236069b3b55502640c99a9e812a:/win32/wince.c#l941
. On WinCE there is no GetEnvironmentVariableA since there are no env
vars on the OS (google for more). Some FOSS projects use a registry key
and get/seting env vars maps to the vals in key. celib provides this
_________________________________________________________________
int XCEAPI
XCEGetEnvironmentVariableA(const char *name, char *buf, int len)
{
  char *p;
  if(buf)
    buf[0] = 0;
  if((p = xcegetenv(name)) == NULL)
    return 0;
  if(buf == NULL)
    return strlen(p);
  strcpy(buf, p);
  return strlen(buf);
}
_________________________________________________________________
but it just calls xcegetenv.

So how should this be fixed, 
__________________________________________________________________
#ifndef UNDER_CE
#  undef getenv
#  undef putenv
#endif
#undef malloc
#undef free

static void
fix_win32_tzenv(void)
{
__________________________________________________________________
like above? That works/compiles, but I'm not sure if it is the best fix.

Other ideas are static inline getenv() in wince.h that just called
xcegetenv(), or have perl517.dll export a "getenv()" on WinCE only.



nntp.perl.org: Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About