void _stdcall TerminatePlugin(void);
In the function TerminatePlugin(), the plugin should do all cleanup required for variables or data structures which were dynamically allocated (such as things created with new), windows, or other things which were instantiated by your plugin, should be cleaned up here.