Archived

This topic is now archived and is closed to further replies.

Soveriegn

"Late binding" Function Pointer resolution

Recommended Posts

Hello I am writing a Console class to try and make a Quake style console. Anyway, I have it using a hash tabel to break commands down into an array of pointers towards objects of a simple class describing the command, ie, the actual syntax, what permissions are required to execute it and so on. Any way, one of the parameters that I want to recieve is a pointer to a function of an indetermined type. I plan on storing it as a part of the command syntax, and will then rebuild it to the right structure to pass to the fuction at run-time. The problem is, that I can''t figure out any way to do this without having a huge list of overloaded functions that will translate the address into a generalized form for me. Is there any other way? Is there any way to really allow total flexability on this, or do I have to restrict the console to a set of permutaitons on function parameter type, order and quantity? Thank you Sleep is for the weak... To bad I need more

Share this post


Link to post
Share on other sites
In practice you don''t complete flexibility. After all, you only want to bind functions with argument types that you can parse from your console. In practice this usually means only needing to deal with numeric and string types, and usually only a single numeric type. When dealing only with function pointers this in turn translates into a rather straightforward method of pushing and popping elements onto the stack. However, you seem to have some other mechanism of storing your callbacks that I''m not quite clear on how you are implementing. I would suggest showing some code to show what you are attempting to accomplish.

Share this post


Link to post
Share on other sites