mysql( mysq_init(), mysql_close );
(or something like that .. can't remember the exact function names)
But you can also "hide" objects with the shared_ptr that will get destroyed with it... I'm not sure quite why you might want to do it, but someone was asking how to do somethign similar in StackOverflow.
Here's how you do it.