#10208: wxDL_GET_LOADED (r56863)

View: New views
4 Messages — Rating Filter:   Alert me  

#10208: wxDL_GET_LOADED (r56863)

by wxTrac :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Ticket URL: <http://trac.wxwidgets.org/ticket/10208>

#10208: wxDL_GET_LOADED (r56863)
---------------------------------------+------------------------------------
 Reporter:  troelsk                    |       Owner:        
     Type:  enhancement                |      Status:  new    
 Priority:  normal                     |   Milestone:        
Component:  wxMSW                      |     Version:  2.9-svn
 Keywords:  wxDynamicLibrary comctl32  |   Blockedby:        
    Patch:  1                          |    Blocking:        
---------------------------------------+------------------------------------
 This new flags seems a good idea, but
 1. Requiring the callee to [remember to] call Detach is a rather bad idea
 (one such Detach call is missing from r56863, in msw/datecontrols.cpp).
 2. If a wx user wants to use "comctl32.dll", he'll need all this in his
 code - not pretty - better remember the new flag!

 wxDynamicLibrary dllComCtl32(_T("comctl32.dll"),
 wxDL_VERBATIM |
 wxDL_QUIET |
 wxDL_GET_LOADED);
 ...Detach()

 Attached simpler solution:
 - Offer comctl32.dll for everyone to use (wxApp::GetComCtrl32)
 - User need not call Detach (if using wxApp::GetComCtrl32)


--
Ticket URL: <http://trac.wxwidgets.org/ticket/10208>
_______________________________________________
wx-dev mailing list
wx-dev@...
http://lists.wxwidgets.org/mailman/listinfo/wx-dev

Re: #10208: wxDL_GET_LOADED (r56863)

by wxTrac :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Ticket URL: <http://trac.wxwidgets.org/ticket/10208#comment:1>

#10208: wxDL_GET_LOADED (r56863)
--------------------------+-------------------------------------------------
  Reporter:  troelsk      |       Owner:                          
      Type:  enhancement  |      Status:  infoneeded_new          
  Priority:  normal       |   Milestone:                          
 Component:  wxMSW        |     Version:  2.9-svn                  
Resolution:               |    Keywords:  wxDynamicLibrary comctl32
 Blockedby:               |       Patch:  1                        
  Blocking:               |  
--------------------------+-------------------------------------------------
Changes (by vadz):

  * status:  new => infoneeded_new


Comment:

 I agree that having to remember to call Detach() is not nice, this is why
 I didn't make this flag public (another reason is that it's MSW-only,
 although this could be mitigated to some extent by using RTLD_NOLOAD under
 Linux if available).

 However I don't like storing flags in wxDynamicLibrary neither, this is
 (intentionally) a very simple and small class adding almost no overhead at
 all compared to using the native calls directly and I'd like to keep it
 this way.

 One way of solving it would be to use GetModuleHandleEx() which does
 increment the module reference count, unlike GetModuleHandle().
 Unfortunately it's not available under old Windows versions.

 Another way would be to define a (private to wxMSW at least for now)
 wxLoadedDynamicLibrary which would pass wxDL_GET_LOADED to the base class
 in its ctor and call Detach() in its dtor. This would preserve 0 overhead
 of the base class. In fact I really don't see any problem with this
 approach and I don't know why I didn't use it. What do you think?

 Thanks!


--
Ticket URL: <http://trac.wxwidgets.org/ticket/10208#comment:1>
_______________________________________________
wx-dev mailing list
wx-dev@...
http://lists.wxwidgets.org/mailman/listinfo/wx-dev

Re: #10208: wxDL_GET_LOADED (r56863)

by wxTrac :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Ticket URL: <http://trac.wxwidgets.org/ticket/10208#comment:2>

#10208: wxDL_GET_LOADED (r56863)
--------------------------+-------------------------------------------------
  Reporter:  troelsk      |       Owner:                          
      Type:  enhancement  |      Status:  new                      
  Priority:  normal       |   Milestone:                          
 Component:  wxMSW        |     Version:  2.9-svn                  
Resolution:               |    Keywords:  wxDynamicLibrary comctl32
 Blockedby:               |       Patch:  1                        
  Blocking:               |  
--------------------------+-------------------------------------------------
Changes (by troelsk):

  * status:  infoneeded_new => new


Comment:

 >this is (intentionally) a very simple and small class adding almost no
 overhead at all compared
 >to using the native calls directly and I'd like to keep it this way.

 This does not really matter, users only have few wxDynamicLibrary
 instances sitting around.
 Only potential [speed] problem is if you [repeatedly] instantiate
 wxDynamicLibrary in OnPaint/OnIdle/WndProc - but you don't because it is
 bad programming.

 Sorry, I like my version better, I see wxApp::GetComCtrl32() as being
 handy. But it is no big deal.


--
Ticket URL: <http://trac.wxwidgets.org/ticket/10208#comment:2>
_______________________________________________
wx-dev mailing list
wx-dev@...
http://lists.wxwidgets.org/mailman/listinfo/wx-dev

Re: #10208: wxDL_GET_LOADED (r56863)

by wxTrac :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Ticket URL: <http://trac.wxwidgets.org/ticket/10208#comment:3>

#10208: wxDL_GET_LOADED (r56863)
--------------------------+-------------------------------------------------
  Reporter:  troelsk      |       Owner:                          
      Type:  enhancement  |      Status:  closed                  
  Priority:  normal       |   Milestone:                          
 Component:  wxMSW        |     Version:  2.9-svn                  
Resolution:  fixed        |    Keywords:  wxDynamicLibrary comctl32
 Blockedby:               |       Patch:  1                        
  Blocking:               |  
--------------------------+-------------------------------------------------
Changes (by VZ):

  * status:  new => closed
  * resolution:  => fixed


Comment:

 (In [57405]) implement wxLoadedDLL, a safer alternative to wxDL_GET_LOADED
 (closes #10208)


--
Ticket URL: <http://trac.wxwidgets.org/ticket/10208#comment:3>
_______________________________________________
wx-dev mailing list
wx-dev@...
http://lists.wxwidgets.org/mailman/listinfo/wx-dev
LightInTheBox - Buy quality products at wholesale price!