From 9ae2ec95cf5cfdf44a5756db24f49a055b5372a1 Mon Sep 17 00:00:00 2001
From: Vadim Zeitlin <vadim@wxwidgets.org>
Date: Tue, 4 Mar 2003 01:48:47 +0000
Subject: [PATCH] added wxDynamicLibrary::Detach()

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@19457 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
---
 docs/latex/wx/dynlib.tex | 8 ++++++++
 include/wx/dynload.h     | 5 +++++
 2 files changed, 13 insertions(+)

diff --git a/docs/latex/wx/dynlib.tex b/docs/latex/wx/dynlib.tex
index 44bdb0972f..49cec53bd8 100644
--- a/docs/latex/wx/dynlib.tex
+++ b/docs/latex/wx/dynlib.tex
@@ -27,6 +27,14 @@ to \helpref{wxDllLoader}{wxdllloader}.
 
 Constructor. Second form calls \helpref{Load}{wxdynamiclibraryload}.
 
+\membersection{wxDynamicLibrary::Detach}\label{wxdynamiclibrarydetach}
+
+\func{wxDllType}{Detach}{\void}
+
+Detaches this object from its library handle, i.e. the object will not unload
+the library any longer in its destructor but it is now the callers
+responsability to do this.
+
 \membersection{wxDynamicLibrary::IsLoaded}\label{wxdynamiclibraryisloaded}
 
 \constfunc{bool}{IsLoaded}{\void}
diff --git a/include/wx/dynload.h b/include/wx/dynload.h
index a1c19d73a9..3bb5e12766 100644
--- a/include/wx/dynload.h
+++ b/include/wx/dynload.h
@@ -128,6 +128,11 @@ public:
 
     bool Load(wxString libname, int flags = wxDL_DEFAULT);
 
+        // detach the library object from its handle, i.e. prevent the object
+        // from unloading the library in its dtor -- the caller is now
+        // responsible for doing this
+    wxDllType Detach() { wxDllType h = m_handle; m_handle = 0; return h; }
+
         // unload the library, also done automatically in dtor
 
     void Unload();
-- 
2.50.0

