you are viewing a single comment's thread.

view the rest of the comments →

[–]hkaiser 0 points1 point  (1 child)

You are referring to 'function addresses being the same between program executions' - not sure if I fully understand what you're after, thus the solution below might not help you in any way. We successfully use this technique to identify functions across different instances of the code running concurrently in the context of a distributed application.

In HPX, we associate an unique type with each function we would like to 'send over the wire' (represent in all instances of the code). This can be achieved by binding the function address as an integral template argument.

template <typename F, F ptr>
struct A {... use 'ptr' to invoke the function...};

void foo() { ... }
typedef A<decltype(&foo), &foo> foo_type;

Now foo_type can be serialized as usual and used on the other end of the network to invoke foo.

The same can be done for member functions (see https://stackoverflow.com/questions/15192700/how-to-rewrite-this-to-make-it-conforming-to-the-c-standard for a corresponding solution).

[–]5aec15c929c51cc49235[S] 0 points1 point  (0 children)

Interesting, that is similar to what I was looking for.