Figure 4: Revised Library class

__gc class Library : public System::IDisposable
{
public:

    Library(System::String* strFileName,
            WindowsAPI::DWORD dwFlags)
    {
        m_hModule = WindowsAPI::LoadLibraryEx(strFileName,
                                              System::IntPtr::Zero,
                                              dwFlags);
    }

    void Dispose()
    {
        if (System::IntPtr::Zero != m_hModule)
        {
            WindowsAPI::FreeLibrary(m_hModule);
            m_hModule = System::IntPtr::Zero;
        }
    }

private:

    System::IntPtr m_hModule;

};
— End of Figure —