<p>I am writing a lib and a demo project. The project doesn't care which version of the lib I use (I can use sdl, directx or whatever I like as the gfx backend). To get the object I do </p>

<pre><code>Obj *obj = libname_newDevice();
</code></pre>

<p>Now, should I use delete or should I do <code>obj-&gt;deleteMe();</code>? I ask because I am not exactly doing new so I shouldn't be doing the delete?</p>

<p>I have <code>obj-&gt;create(theType);</code> which returns a class with the Obj interface.
My real question is do I need a <code>libname_deleteDevice();</code> or is <code>obj-&gt;deleteMe()</code> fine since I have a deleteMe in the interface?</p>

Since you are abstracting the creation inside
```
libname_newDevice()
```
(which I have to say isn't a good approach), you should destroy using something like
```
libname_destroyDevice (obj)
```
.
And as the comment from Martin suggests, it's best to put them in the constructor and destructor of a custom class, that you just need to create on stack, and the compiler will take care of the rest.