You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@perl.apache.org by Stas Bekman <st...@stason.org> on 2001/12/11 19:07:20 UTC

[Fwd: Re: using one mod_perl's .so in another .so?]

I've a problem with using functions from one .so in another .so

I'm working on Apache::SubProcess.
The subprocess returns the pipes to in/out/err and I try to convert them 
into PerlIO there. so you can do

($in, $out, $err) = run_proc(...);

apr_perlio_trans from APR::PerlIO performs the conversion. But I get 
this error, when I call this function in Apache__SubProcess.h:

/home/stas/httpd/prefork/bin/httpd: relocation error: 
/home/stas/apache.org/mp-subproc/blib/arch/auto/Apache/SubProcess/SubProcess.so: 
undefined symbol: apr_perlio_trans

in apr_perl_io.h I expose:

PerlIO *apr_perlio_trans(pTHX_ apr_file_t *file, apr_pool_t *pool);

and then I try to call it from SubProcess.h's function, which includes
apr_perl_io.h

If I do nm on PerlIO.so, it's there:

00001a40 T apr_perlio_trans

the actual test fails on loading Apache::SubProcess with the error from 
above when I do:

use APR::PerlIO;
use Apache::SubProcess;

Also what's the proper way to include one .h file in another .h in such 
a situation. Currently I do:

#include "../../APR/PerlIO/apr_perlio.h"

in xs/Apache/SubProcess/Apache__SubProcess.h. Which doesn't look right.

Thanks.
_____________________________________________________________________
Stas Bekman             JAm_pH      --   Just Another mod_perl Hacker
http://stason.org/      mod_perl Guide   http://perl.apache.org/guide
mailto:stas@stason.org  http://ticketmaster.com http://apacheweek.com
http://singlesheaven.com http://perl.apache.org http://perlmonth.com/


-- 


_____________________________________________________________________
Stas Bekman             JAm_pH      --   Just Another mod_perl Hacker
http://stason.org/      mod_perl Guide   http://perl.apache.org/guide
mailto:stas@stason.org  http://ticketmaster.com http://apacheweek.com
http://singlesheaven.com http://perl.apache.org http://perlmonth.com/


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


Re: [Fwd: Re: using one mod_perl's .so in another .so?]

Posted by Stas Bekman <st...@stason.org>.
Doug MacEachern wrote:

> you won't be able to call it directly without some work.  see the manpage 
> on dlopen and see how XSLoader/DynaLoader opens the file.  you could
> change dl_load_flags to be 0x01 and bing it'll work.  but that's on your  
> linux box, problems will happen on other platforms such as win32, hpux,   
> aix.
> 
> you could try using apr optional functions.  or have APR::PerlIO store a   
> pointer to the function you need somewhere in the perl symbol table, which
> would work the same way, different api.  apr's would be cleaner.
> 
> could also build a libaprperlio.so and link the extension .so's
> against it, but that would end up being painful.
> 
> there are a some other tricks, but not all are portable.


I've used the APR's optional functions. It works :) Thanks Doug!


> as for the header file, you could just move that to the xs/ directory.

Thanks.


_____________________________________________________________________
Stas Bekman             JAm_pH      --   Just Another mod_perl Hacker
http://stason.org/      mod_perl Guide   http://perl.apache.org/guide
mailto:stas@stason.org  http://ticketmaster.com http://apacheweek.com
http://singlesheaven.com http://perl.apache.org http://perlmonth.com/


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


Re: [Fwd: Re: using one mod_perl's .so in another .so?]

Posted by Doug MacEachern <do...@covalent.net>.
you won't be able to call it directly without some work.  see the manpage 
on dlopen and see how XSLoader/DynaLoader opens the file.  you could
change dl_load_flags to be 0x01 and bing it'll work.  but that's on your  
linux box, problems will happen on other platforms such as win32, hpux,   
aix.

you could try using apr optional functions.  or have APR::PerlIO store a   
pointer to the function you need somewhere in the perl symbol table, which
would work the same way, different api.  apr's would be cleaner.

could also build a libaprperlio.so and link the extension .so's
against it, but that would end up being painful.

there are a some other tricks, but not all are portable.

as for the header file, you could just move that to the xs/ directory.



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