ram, you'll be getting into the C bindings to do that. It's a nasty place. I strongly suggest not doing that and just checking out the code. You have to track SVN memory pools, and a bunch of other stuff you really, really don't care about.
This is based on the system I used to work with at Yahoo! that used the C bindings. The code, it burned.