apr-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "James Mansion" <ja...@wgold.demon.co.uk>
Subject RE: utilizing APR in existing c++ app
Date Thu, 23 Mar 2006 08:06:43 GMT
I've seen a snazzy template for doing that - but I can't remember where.

Maybe Google will find it.


-----Original Message-----
From: Michael Vergoz [mailto:mv@binarysec.com]
Sent: 22 March 2006 09:49
To: Alex.Krumm-Heller@csiro.au; dev@apr.apache.org
Subject: Re: utilizing APR in existing c++ app


There is no really difference between using APR with C or C++ excepting
In general you don't need to create a pool per object. You should to use the
existing pool (depends your application).
Here is an example :
static apr_status_t my_callback_destructor(void *data) {
            obj *myobj = (obj *)data;
            delete myobj;

int afunction(apr_pool_t *pool) {
            obj *myobj = new obj;
            apr_pool_cleanup_register(pool, (void *)myobj,
my_callback_destructor, my_callback_destructor);

Michael Vergoz

From: <Alex.Krumm-Heller@csiro.au>
To: <dev@apr.apache.org>
Sent: Wednesday, March 22, 2006 7:58 AM
Subject: utilizing APR in existing c++ app


I was wondering if there was any documentation in terms of strategies
for utilizing APR in an existing c++ codebase? The main problem I have
is how to deal with the memory pools that are required for APR
functions. Is it best to create one giant global pool for the entire
application and have all APR functions use the global pool, or is it
better to have a pool exist per object for the lifetime of an object and
all APR usage within that object utilise its own pool? Any suggestions?

View raw message