Thanks Arnaud for this valuable reference.
I am testing the code now. I had to do some minor changes to make it work in my
machine. Here I put them for future reference:
1-Assuming that all the .h and .cpp files are in the same directory (as they
come in the zip file), change
#include "../ObjectHandle.h" to #include "ObjectHandle.h" in mex_destroy.cpp
and mex_create.cpp
2-Change lines 113 and 114 of ObjectHandle.h to
typename std::list<ObjectHandle<T>*>::iterator i;
typename std::list<ObjectHandle<T>*>::iterator end= objlist.end();
(note the addition of 'typename')
3-It seems that the code is for 32 bits. As I have a 64 bits machine, I had to
change all the occurences of mxINT32_CLASS to mxINT64_CLASS (lines 140 and 167)
You can also use the the classID mxDOUBLE_CLASS to be independant of
the machine. Tested and works perfectly with Windows 32/64-bit as well
as Linux Ubuntu 32/64-bit.