On Thu, Nov 12, 2009 at 2:55 AM, elizabeta petreska <elizabeta.petreska@gmail.com> wrote:
Hello everybody
This is my first post to the list.
Can I serialize C++ function pointer ? I search around and found that it could not be done ( although I am not sure ).
If it can not be done, whats the explanation about it ?
Thanks
 
The location of a function pointer in the address space could change depending on a number of factors:
So, it could possibly work, but I would highly recommend that you don't do this.

Other options:

- Wrap your functions in classes, and use the standard serialization methods for class objects.
- Have a function in your binary that registers all of the function pointers (a std::map would suffice) that you care about at startup, perhaps indexed by a string. Then, serialize the names of the functions that you want to save.

Can you describe your use case in more detail?

Jeremy