I'm currently writing a wrapper, and I am using pimpl to be able to use the same interface for multiple libraries. I'm not quite sure if I'm approaching this in a good way however. Is it worth using pimpl for things that aren't platform specific? What I'm writing now is a Bullet Physics library wrapper. I have made a RigidBody class and a World class. These classes then have their respective "btRigidBody" and "btDiscreteDynamicsWorld" pointers. My goal is to make my API consistent and not need to use any Bullet code in my client code.
Now, to my problem:
The World class needs to access RigidBody's btRigidBody pointer. And the RigidBody needs World's btDiscreteDynamicsWorld pointer.
How do I do this without having any Bullet-specific includes in the header files?
I have come up with an idea, but I feel that it is relatively ugly. My idea is that I have a "void* getRigidBody()" and "void* getWorld()", and then cast them to either btRigidBody* or btDiscreteDynamicsWorld*.
I could just go ahead and implement that idea, but it feels like I'm thinking about this in a wrong way.
Does anyone have any suggestions?
Thanks in advance.