httpd-modules-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Nick Kew <n...@webthing.com>
Subject Re: Share data between modules
Date Thu, 12 Oct 2006 13:48:56 GMT
On Thursday 12 October 2006 14:37, m.spinetti@pisa.iol.it wrote:
> 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?

  apr_hash_t* get_hash(server_rec* s) {
      server_cfg* cfg =
		ap_get_module_config(s->module_config, &exporting_module);
      return cfg->hash;
   }

Or variants thereupon.

-- 
Nick Kew

Application Development with Apache - the Apache Modules Book
http://www.prenhallprofessional.com/title/0132409674

Mime
View raw message