Fix support for importing and exporting Registry objects on Windows
On Windows, most compilers will produce a DLL with their own global Tail and Head variables, so we copy these variables returned from an exported function of the DLLs into the consumer Registry, but some (such as MinGW) shares it with the consumer (same as on other platforms).
Add a check before the copy to skip it if we detect the Head returned is the same as the consumer one, avoiding to copy it into itself, which is an infinite copy.
Also add null-check to avoid crash when exporting a DLL with no plugin registered.
Edit CMake rules to allow compiling example plugins on Windows.