httpd-modules-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "m.spinetti@pisa.iol.it"<m.spine...@pisa.iol.it>
Subject Re: Share data between modules
Date Thu, 12 Oct 2006 13:54:46 GMT
Maybe I have to use it....
In module A I declare apr_hash_t; in the post config I creates and
populates it. Then I write a funcion called my_function and in the
register_hooks I write:

APR_REGISTER_OPTIONAL_FN(my_function);

Then in my file.h I write:

APR_DECLARE_OPTIONAL_FN(..., my_function, ...);

After that, my modules B and C can call my_function nad retrieve a value
of a given key.

Is it ok?

Marco

> Hi Nick,
> 
> > On Thursday 12 October 2006 13:41, m.spinetti@pisa.iol.it wrote:
> > 
> > > So my idea was that one of the three modules parses the file, creates
> > > the hash_table_t and populates it. Then each child of these modules
> > > should be able to read (only read e not write) the hash table.
> > > Is it possible in your opinion?
> > 
> > Of course.  The module just needs to export an accessor function,
> > to access either the hash itself or the value of a given key.
> > Use APR_OPTIONAL if you want to keep them fully independent
> > at link time.
> 
> I'm a bit confused... I have to declare my apr_hash_t* in the module
> which creates and populates it and then export an accessor function.
> But how can I export an accessor function?
> Where should I use APR_OPTIONAL?
> 
> Regards
> 
> Marco
> 
> > 
> > > I suppose that I have to use apr_shm_t (and apr_rmm_init??).
> > 
> > Erm, why?
> > 
> > -- 
> > Nick Kew
> > 
> > Application Development with Apache - the Apache Modules Book
> > http://www.prenhallprofessional.com/title/0132409674
> > 
> 
> 


Mime
View raw message