httpd-apreq-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Stas Bekman <s...@stason.org>
Subject Re: [apreq2] proper support for ithreads
Date Wed, 18 Feb 2004 21:54:00 GMT
Beau E. Cox wrote:
[...]
> OK, but I also got:
> 
> Attempt to free unreferenced scalar: SV 0x40601238 
> at /usr/lib/perl5/site_perl/5.8.2/HTML/Mason/Request.pm line 160.
> Attempt to free unreferenced scalar: SV 0x40601238 
> at /usr/lib/perl5/site_perl/5.8.2/HTML/Mason/Request.pm line 161.

And these warnings go away with 5.8.3? Do you get them only when using DBI or 
with out as well? If Mason doesn't use XS, which modules that use XS does it load?

> Anyway, sure, I should have time this week for DBI (and then maybe I
> can attack Mason), but I'll need some coaching to fix DBI.
> 
> So as a plan, I'll get DBI and try to make some headway; when I have
> a better feeling for how to fix the problem, I'll post questions
> here, OK?

Sure. This is relevant to any XS module. You start by including:

#define PERL_NO_GET_CONTEXT

before these loads:

#include <EXTERN.h>
#include <perl.h>
#include <XSUB.h>

So in case of DBI, that would be:

--- DBIXS.h.orig        2004-02-18 13:46:24.000000000 -0800
+++ DBIXS.h     2004-02-18 13:46:53.000000000 -0800
@@ -14,6 +14,7 @@
  #endif

  /* first pull in the standard Perl header files for extensions */
+#define PERL_NO_GET_CONTEXT /* we want efficiency */
  #define PERL_POLLUTE
  #include <EXTERN.h>
  #include <perl.h>

then, when you build things. You will start getting errors like these:

In file included from Perl.c:40:
Driver_xst.h: In function `dbixst_bounce_method':
Driver_xst.h:14: error: `my_perl' undeclared (first use in this function)
Driver_xst.h:14: error: (Each undeclared identifier is reported only once
Driver_xst.h:14: error: for each function it appears in.)
Driver_xst.h: In function `dbdxst_bind_params':
Driver_xst.h:54: error: `my_perl' undeclared (first use in this function)
Driver_xst.h: In function `dbdxst_fetchall_arrayref':
Driver_xst.h:75: error: `my_perl' undeclared (first use in this function)

So you need to add pTHX/pTHX_ as the first argument in function declarations 
and aTHX/aTHX_ in the function calls. And eventually these errors will go 
away. Do not use dTHX, since it reverts things to the way they were before. 
And as you go eliminate any dTHX calls that you use. For more information 
please refer to the perlguts manpage, when it talks about:

    The third, even more efficient way is to ape how it is done within
    the Perl guts:
    ...

now any follow ups to this specific issue of DBI should probably go to the 
dbi-dev mailing list, since it's off topic to this list.

__________________________________________________________________
Stas Bekman            JAm_pH ------> Just Another mod_perl Hacker
http://stason.org/     mod_perl Guide ---> http://perl.apache.org
mailto:stas@stason.org http://use.perl.org http://apacheweek.com
http://modperlbook.org http://apache.org   http://ticketmaster.com

Mime
View raw message