Hi *Antony*,
Looks very interesting to me, especially the plugins part.
Thanks, :)
template
ReturnType* get_symbol(const symbol_type<T> &sb);
Now ((pluginapi_create)sl("create_my_plugin")) will look slightly better:
sl.get_symbol
("create_my_plugin");
Very nice, and makes things simpler, I will implement in next revision! Thanks!
what will happen with the application, if shred library goes out of scope but we continue to use symbols from it? Must it be prevented somehow by the Application library? Is it described in docs?
Well, the “shared_library” is a simple wrapper around Windows and POSIX
API, and don’t have any counting in it, in this case the destructor will
run and “unload lib will be called”, and the call to symbol will be
insecure. So the “shared_library” need stay on scope, e.g:
my_plugin_api*** plugin *=* NULL;
{
shared_library *sl*(library("lib.so"));
*if*(sl.search_symbol(symbol("myfunc")))
{
plugin *=* ((pluginapi_create)sl(symbol("myfunc")))();
}
*if*(plugin *!=* NULL)
{
// secure to use
}
}
// user must not use plugin here
Please send your ideas and comments, so I can improve the lib! Thanks!
PS. You wrote: Boost C++ Application Development Cookbook? I have your
book, and I always use it in my work, very good source! Thanks for that!
2014-07-28 18:13 GMT-03:00 Antony Polukhin
2014-07-28 21:46 GMT+04:00 Renato Forti
: Hi All,
This e-mail is only to inform news about proposed Boost.Application library.
Looks very interesting to me, especially the plugins part.
A few notes\questions: * how about adding an additional template parameter to the get_symbol method:
template
ReturnType* get_symbol(const symbol_type<T> &sb); Now ((pluginapi_create)sl("create_my_plugin")) will look slightly better:
sl.get_symbol
("create_my_plugin"); * what will happen with the application, if shred library goes out of scope but we continue to use symbols from it? Must it be prevented somehow by the Application library? Is it described in docs?
-- Best regards, Antony Polukhin
_______________________________________________ Unsubscribe & other changes: http://lists.boost.org/mailman/listinfo.cgi/boost