"Igor R"
Ok, thank you. So the way to go is to make "manual" function objects...
We have a system that serializes boost::function - they are used as factory objects that are sent through sockets (via asio). We only support serializing boost::function with functors, but the mechanism works well. Fortunately, boost::function has the target<> method that can be used to get access to the original type. As touched upon by an earlier post, we have to look up the types from some kind of registry that associates the boost::function (the signature) with the type (the functor) that can be assigned into it. This means we have to register each association, but this is similar to registering polymorphic class types (i.e. archive.register_type<>). It may be possible to generalize the mechanism, but it would probably require a new export macro that can associate the types, e.g. a BOOST_FUNCTION_EXPORT(signature, func_name, type, type_name) to go along with BOOST_CLASS_EXPORT.