I've seen a snazzy template for doing that - but I can't remember where. Maybe Google will find it.
James -----Original Message----- From: Michael Vergoz [mailto:[EMAIL PROTECTED] Sent: 22 March 2006 09:49 To: [EMAIL PROTECTED]; dev@apr.apache.org Subject: Re: utilizing APR in existing c++ app Hi, There is no really difference between using APR with C or C++ excepting callbacks. 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: <[EMAIL PROTECTED]> To: <dev@apr.apache.org> Sent: Wednesday, March 22, 2006 7:58 AM Subject: utilizing APR in existing c++ app Hi, 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?