--- DBI.xs +++ DBI.xs @@ -265,6 +265,10 @@ /* publish address of dbistate so dynaloaded DBD's can find it */ sv_setiv(perl_get_sv(DBISTATE_PERLNAME,1), PTR2IV(DBIS)); +#if defined(MULTIPLICITY) || defined(PERL_OBJECT) || defined(PERL_CAPI) + /* needed if sizeof(IV) != sizeof(void *) */ + (*(INT2PTR(dbistate_t**, &SvIVX(DBISTATE_ADDRSV)))) = DBIS; +#endif DBISTATE_INIT; /* check DBD code to set DBIS from DBISTATE_PERLNAME */