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

Re: Tk 800.018 Build failure on Perl 5.5.640 (MSWin32-x86-multi-thread)

From:
Gurusamy Sarathy
Date:
February 9, 2000 14:54
Subject:
Re: Tk 800.018 Build failure on Perl 5.5.640 (MSWin32-x86-multi-thread)
Message ID:
200002092256.OAA14255@maul.activestate.com
On Wed, 09 Feb 2000 22:29:40 GMT, Nick Ing-Simmons wrote:
>Paul Moore <gustav@morpheus.demon.co.uk> writes:
>>I'm trying to build Tk800.018 under Perl 5.5.640. I've built Perl on Win32,
>>using MSVC 6 with the USE_MULTI/USE_ITHREADS/USE_IMP_SYS options (basically, the
>>new fork emulation on Win32). The build failed with errors in tkGlue.c. The
>>errors are attached - looking at cop.h, there is a specific difference under
>>USE_ITHREADS. I don't know how to fix it, unfortunately :-)
>
>Hmm, the code in question is attempting to set cop_stash to NULL
>before looking up a symbolic reference. I cannot remember why 
>it does that - it has something to do with making 
>
>  -textvariable => 'Foo',
>
>Get what "someone" thought was the "right" package's $Foo.
>Note that \$Foo or 'Where::Foo' should work fine , it is just 
>unqualified symrefs that are affected.
>
>Thus if you are doing using unqualifed symrefs a
>quick
>
>#if 0
>#endif
>
>round that if (SvPOK()) 
>should work round the issue.

Here's a somewhat better fix.  You'll need to #define default Cop*
macros in a Tk header somewhere for the sake of older versions:

    #ifndef CopSTASH
    #  define CopSTASH(c)		c->cop_stash
    #  define CopSTASH_set(c,h)		(CopSTASH(c) = h)
    #endif

I'd eventually like to replace the need for peeking into PL_curcop
(and indeed, *any* global inside perl) with real functions in the
API that fit that need.  Suggestions/patches for these welcome.


Sarathy
gsar@ActiveState.com
-----------------------------------8<-----------------------------------
--- ./Tk/tkGlue.c.~1~	Wed Feb  9 14:40:39 2000
+++ Tk/tkGlue.c	Wed Feb  9 14:40:39 2000
@@ -3890,12 +3890,16 @@
  else if (SvPOK(sv))
   {
    dTHR;
-   HV *old_stash = PL_curcop->cop_stash;
+   HV *old_stash = CopSTASH(PL_curcop);
    char *name;
    SV *x = NULL;
    int prefix = '?';
    name = SvPV(sv,na);
-   PL_curcop->cop_stash = NULL;
+#ifdef USE_ITHREADS
+   CopSTASHPV(PL_curcop) = NULL;
+#else
+   CopSTASH(PL_curcop) = NULL;
+#endif
    switch (type)
     {
      case TK_CONFIG_SCALARVAR:
@@ -3919,7 +3923,7 @@
       prefix = '%';
       break;
     }
-   PL_curcop->cop_stash = old_stash;
+   CopSTASH_set(PL_curcop, old_stash);
    if (x)
     {
      *vp = SvREFCNT_inc(x);
End of Patch.



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