Don't know much about ctypes, just recently began working with it.
I have a simple function in C-like dll which returns a pointer to the dynamically generated string.
It is working fine, but, because i manually allocated memory for the string, i should free it after use.
I have something like this:
extern "C" char* DLL_EXPORT func(const char* str1, const char* str2)
{
return getSomeString(str1, str2);
}
// Goal is to call this function correctly from Python.
extern "C" void DLL_EXPORT freeMem(void *mem)
{
if(mem!=NULL)
delete mem;
}
But i don't have any idea, how can i pass received pointer back for deletion in Python?