www.digitalmars.com         C & C++   DMDScript  

c++.stlsoft - One more bug in 1.8.1

reply "Pablo Aguilar" <paguilarg hotmail.com> writes:
I'm using winstl_module and the function module::get_handle() isn't 
implemented!
It's a one liner, so I guess it's easy to forget... or is winstl_module not 
ready for public use yet?

BTW, I'd done one of these before, and had given it an extra function (extra 
as in "besides just loading/unloading"):

 template<typename FnType>
 bool get_fn(char const* fn_name, FnType& fn) const
 {
  assert(m_dll != NULL);

  fn = reinterpret_cast<FnType>(GetProcAddress(m_dll, fn_name));
  return (fn != NULL);
 }

So all you do is use:

  void (*run)() = NULL;

  if( updater.get_fn("run", run) )
   run();

Where run can be of any type... it's not that great but it saves you the 
typedef or the double typing when getting a function's address. 
Oct 05 2004
next sibling parent "Matthew" <admin.hat stlsoft.dot.org> writes:
"Pablo Aguilar" <paguilarg hotmail.com> wrote in message
news:cjvfib$13ti$1 digitaldaemon.com...
 I'm using winstl_module and the function module::get_handle() isn't
implemented!
 It's a one liner, so I guess it's easy to forget... or is winstl_module not
ready for public use yet?

Fixed. Silly me, eh?
 BTW, I'd done one of these before, and had given it an extra function (extra
as in "besides just loading/unloading"):

 template<typename FnType>
 bool get_fn(char const* fn_name, FnType& fn) const
 {
  assert(m_dll != NULL);

  fn = reinterpret_cast<FnType>(GetProcAddress(m_dll, fn_name));
  return (fn != NULL);
 }

 So all you do is use:

  void (*run)() = NULL;

  if( updater.get_fn("run", run) )
   run();

 Where run can be of any type... it's not that great but it saves you the
typedef or the double typing when getting a 
 function's address.

That's a nice idea.
Oct 08 2004
prev sibling parent reply "Matthew" <admin stlsoft.dot.dot.dot.dot.org> writes:
This is now in winstl::module. I've also enhanced the class so that it 
can participate in copy construction, by ref-counting the underlying 
module (via GetModuleFileName and LoadLibrary).

This'll be in 1.8.3.

"Pablo Aguilar" <paguilarg hotmail.com> wrote in message 
news:cjvfib$13ti$1 digitaldaemon.com...
 I'm using winstl_module and the function module::get_handle() isn't 
 implemented!
 It's a one liner, so I guess it's easy to forget... or is 
 winstl_module not ready for public use yet?

 BTW, I'd done one of these before, and had given it an extra function 
 (extra as in "besides just loading/unloading"):

 template<typename FnType>
 bool get_fn(char const* fn_name, FnType& fn) const
 {
  assert(m_dll != NULL);

  fn = reinterpret_cast<FnType>(GetProcAddress(m_dll, fn_name));
  return (fn != NULL);
 }

 So all you do is use:

  void (*run)() = NULL;

  if( updater.get_fn("run", run) )
   run();

 Where run can be of any type... it's not that great but it saves you 
 the typedef or the double typing when getting a function's address.
 

Feb 02 2005
parent "Pablo Aguilar" <paguilarg hotmail.com> writes:
"Matthew" <admin stlsoft.dot.dot.dot.dot.org> wrote in message 
news:cts8ud$1p3q$1 digitaldaemon.com...
 This is now in winstl::module. I've also enhanced the class so that it can 
 participate in copy construction, by ref-counting the underlying module 
 (via GetModuleFileName and LoadLibrary).

 This'll be in 1.8.3.

Great!
Feb 03 2005