Boost logo

Boost :

Subject: Re: [boost] News about proposed Boost.Application library
From: Renato Forti (rtforti_at_[hidden])
Date: 2014-07-28 18:47:59


Hi *Antony*,

>> Looks very interesting to me, especially the plugins part.

Thanks, :)

>> template <typename ReturnType, typename T>

>> ReturnType* get_symbol(const symbol_type<T> &sb);

>> Now ((pluginapi_create)sl("create_my_plugin")) will look slightly better:

>> sl.get_symbol<pluginapi_create>("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 <antoshkka_at_[hidden]>:

> 2014-07-28 21:46 GMT+04:00 Renato Forti <rtforti_at_[hidden]>:
>
> > 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 <typename ReturnType, typename T>
> ReturnType* get_symbol(const symbol_type<T> &sb);
>
> Now ((pluginapi_create)sl("create_my_plugin")) will look slightly better:
>
> sl.get_symbol<pluginapi_create>("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
>


Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk