Figure 3: First pass at writing a Managed C++ class to wrap library functions
__gc class Library { public: Library(System::String* strFileName, WindowsAPI::DWORD dwFlags) { m_hModule = WindowsAPI::LoadLibraryEx(strFileName, System::IntPtr::Zero, dwFlags); } ~Library() { WindowsAPI::FreeLibrary(m_hModule); } private: System::IntPtr m_hModule; }; End of Figure