perl-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Steve Hay <steve....@uk.radan.com>
Subject Re: [PATCH] Re: What Perl configuration is required for mp2 on Win32?
Date Thu, 03 Feb 2005 09:25:44 GMT
Stas Bekman wrote:

>Steve Hay wrote:
>[...]
>  
>
>>After further investigation, I've realised that actually Philippe's 
>>patch DOES fix the problem.
>>
>>[...]
>>So could somebody please apply the attached patch.  (This version 
>>updates PERL_SYS_INIT() to PERL_SYS_INIT3() as per perlembed, and fixes 
>>an "Illegal indirection" error which simply calling PERL_SYS_INIT3(0, 
>>NULL, NULL) produces.)
>>    
>>
>
>>Index: src/modules/perl/mod_perl.c
>>===================================================================
>>--- src/modules/perl/mod_perl.c	(revision 149511)
>>+++ src/modules/perl/mod_perl.c	(working copy)
>>@@ -542,11 +542,14 @@
>>  */
>> static apr_status_t modperl_sys_init(void)
>> {
>>+    int argc = 0;
>>+    char **argv = NULL, env = NULL;
>>+
>>     MP_TRACE_i(MP_FUNC, "mod_perl sys init\n");
>> 
>>+    PERL_SYS_INIT3(&argc, &argv, &env);
>>    
>>
>
>As on unix the above macro expands to something that doesn't use either of 
>these 3 arguments we get:
>
>mod_perl.c: In function `modperl_sys_init':
>mod_perl.c:545: warning: unused variable `argc'
>mod_perl.c:546: warning: unused variable `argv'
>mod_perl.c:546: warning: unused variable `env'
>  
>
Damn.  Didn't think of that.

>Please try this patch instead:
>
>Index: src/modules/perl/mod_perl.c
>===================================================================
>--- src/modules/perl/mod_perl.c	(revision 151089)
>+++ src/modules/perl/mod_perl.c	(working copy)
>@@ -544,9 +544,9 @@
>  {
>      MP_TRACE_i(MP_FUNC, "mod_perl sys init\n");
>
>-#if 0 /*XXX*/
>-    PERL_SYS_INIT(0, NULL);
>+    PERL_SYS_INIT3(0, NULL, NULL);
>  
>
No -- as I said in my last mail (quoted above) that gives an "Illegal 
indirection" error, which is why I was moved to supply some variables 
instead.

The full error text is this:

mod_perl.c(547) : error C2100: illegal indirection
mod_perl.c(547) : error C2100: illegal indirection
NMAKE : fatal error U1077: 'cl' : return code '0x2'
Stop.
NMAKE : fatal error U1077: 'cd' : return code '0x2'
Stop.

The MSDN docs describe compiler error "C2100: illegal indirection" as 
follows:

    "The indirection operator (*) was applied to a nonpointer value."

The reason is that on Win32 PERL_SYS_INIT3(a,b,c) is

    MALLOC_CHECK_TAINT2(*a,*b);
    Perl_win32_init(a,b);

so it's the *a and *b in the MALLOC_CHECK_TAINT2() call which it's 
whining about in the case where a and b were non-pointers.  So the 
obvious fix seemed to be:

    PERL_SYS_INIT3((int *)NULL, (char ***)NULL, (char ***)NULL);

This compiles cleanly, but then crashes on startup because now it's 
trying to resolve the NULL pointer values!

Explicitly calling

    MALLOC_CHECK_TAINT2(0, (char **)NULL);
    Perl_win32_init((int *)0, (char ***)NULL);

works (both compiling and running), but that's cheating (and also won't 
work on Linux ;)

Any other ideas?  If not then can you live with the warnings about 
unused variables?  That's at least better than the situation for me 
without a PERL_SYS_INIT3() call at all ;)

- Steve


------------------------------------------------
Radan Computational Ltd.

The information contained in this message and any files transmitted with it are confidential
and intended for the addressee(s) only.  If you have received this message in error or there
are any problems, please notify the sender immediately.  The unauthorized use, disclosure,
copying or alteration of this message is strictly forbidden.  Note that any views or opinions
presented in this email are solely those of the author and do not necessarily represent those
of Radan Computational Ltd.  The recipient(s) of this message should check it and any attached
files for viruses: Radan Computational will accept no liability for any damage caused by any
virus transmitted by this email.


---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@perl.apache.org
For additional commands, e-mail: dev-help@perl.apache.org


Mime
View raw message