apr-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Michael Vergoz" ...@binarysec.com>
Subject Re: utilizing APR in existing c++ app
Date Wed, 22 Mar 2006 09:48:55 GMT

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