In addition to the analysis of video streams, I encountered a major problem this afternoon: The delete operation failed to export class-defined object pointers from DLL, memory leaks and memory leaks are the most common problems I 've encountered in the past few months. After getting used to Java and C #, I suddenly started to use C ++, and the memory would make you speechless. I finally couldn't find the problem, but I had to find a solution. I gave it a question: finally, we decided to add two global functions in the DLL and then export the two global functions, the same as calling the two functions in the called Project. One function returns an object pointer, And the other function releases the pointer. Needless to say, this method is done, but I still don't know why delete fails in the call project. Continue to observe...
On the weekend, I re-wrote a small program for testing. It seems that there was no memory leakage and it was very depressing...
First, record my solutions at that time:
Two global functions are added to the DLL typing class:
For example:
Void createinstanceptr (void **, void * Arglist );
Void freeinstanceptr (void **);
Someone may ask why void is used **. This is mainly for the passed pointer to a new object, so the pointer must be used. Well, write it here. The root problem is indeed not found. You still need to observe it with patience.