3

I've obtained a function pointer at run-time, let's say through something like GetProcAddress (so a weakly-typed void*), and then I've got this metadata that tells me what the function's signature is at run-time. How can I call the function correctly, preferably in Standard code? C++0x solution is fine, and I don't mind having to enforce my own type-safety.

1
  • I know seems redudant, but, its the destination function in a shared object / dynamic library, or its the same program ? Commented Jun 22, 2011 at 15:03

1 Answer 1

1

Er... no, you can't. There is no thing like reflection is C++ or C++0x, you can't get a type out of a string or whatever. Unfortunately :)

Sign up to request clarification or add additional context in comments.

3 Comments

If there are limits to the function signatures, though, and he knows what the specific possibilities are, couldn't he parse the metadata and cast the function pointer to a specific (possibly overloaded) function based on that?
@JAB: I'd have to generate all possible overloads before-hand, which could be millions of permutations or more.
It is possible to do - that's what Excel does when it calls XLLs. But you might need to resort to assembler to do it.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.