| Thread overview | ||||||
|---|---|---|---|---|---|---|
|
October 06, 2004 One more bug in 1.8.1 | ||||
|---|---|---|---|---|
| ||||
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.
| ||||
October 08, 2004 Re: One more bug in 1.8.1 | ||||
|---|---|---|---|---|
| ||||
Posted in reply to Pablo Aguilar | "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. | |||
February 03, 2005 Re: One more bug in 1.8.1 | ||||
|---|---|---|---|---|
| ||||
Posted in reply to Pablo Aguilar | 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. > | |||
February 03, 2005 Re: One more bug in 1.8.1 | ||||
|---|---|---|---|---|
| ||||
Posted in reply to Matthew | "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! | |||
Copyright © 1999-2021 by the D Language Foundation
Permalink
Reply