For example, if XSILoadPlugin() terminates prematurely by returning
XSI::CStatus::Fail, does XSIUnloadPlugin() get called? Or does
XSIUnloadPlugin() only get called if XSILoadPlugin() returns
XSI::CStatus::OK indicating the plugin has successfully completed
loading? If XSIUnloadPlugin() gets called in all cases, are there
exceptions to what will/won't be available in that callback?
Maybe some of the Autodesk devs could provide a definite answer.
However, if I had that architectural issue (and I've had it before :) ),
I would play it safe and write the XSIUnloadPlugin code in such a way as
to allow it to work cleanly even if called multiple times, or after a
partially completed XSILoadPlugin.
Just set any pointers to released memory to NULL (so that a potential
repeated delete/free would just work as a no-op), set DLL handles to
NULL after calling FreeLibrary on them, etc.
Defensive coding should always be applied to cleanup methods /
destructors, IMHO.
K.