I am using ctypes to access a c library (it is really c++ code) from python:
class CRMeAnnotationList(object):
def __init__(self):
self.obj = lib.CRMeAnnotationList_new()de
def __del__(self):
if self.obj:
lib.CRMeAnnotationList_destroy(self.obj)
lst = CRMeAnnotationList()
The C code looks like this
extern "C" {__declspec(dllexport) CRMeAnnotationList* CRMeAnnotationList_new()
{ return new CRMeAnnotationList();
}
__declspec(dllexport)void CRMeAnnotationList_destroy(CRMeAnnotationList* p)
{
if (p)
delete p;
}
}
This code gives me finished with exit code -1073741819 (0xC0000005)
whereas if I do not destroy the pointer I get 0 as exit code.
Does this mean, that I do not need to destroy that pointer i.e execute the destructor part del in the python code?