D - Run-time function calls
- psheer AT icon DOT co DOT za (22/22) Aug 22 2001 In C it is impossible to create a run-time function call. This makes
- Kent Sandvik (7/18) Aug 22 2001 Runtime binding calls style Objective-C syntax, send any message to any ...
In C it is impossible to create a run-time function call. This makes implementing signals in Gtk very awkward. Gtk defines a type list with macros for each kind of C type. There are many situations where libraries could be simplified if there were a way of "manually" creating a function call with run-time specified argument ltypes. This is because a library should be able to be passed a call-back function whose prototype is not known at the time that the library was compiled. The library should have a run-time facility for calling any function prototype by building the arguments to that function from some kind of template passed to the library. Hence the name "Run-time function call". Interpretors use this facility to great effect. For example: /* this function's prototype was not known as run time */ void foo (char this, int that, float etc); apply (foo, special_arg_list_object); I don't know what's the best way of implementing it. -paul -- Paul Sheer Consulting IT Services . . . Tel . . . +27 21 761 7224 Linux development, cryptography, recuitment, support, training http://www.icon.co.za/~psheer . . . . http://rute.sourceforge.net L I N U X . . . . . . . . . . . . The Choice of a GNU Generation
Aug 22 2001
"psheer AT icon DOT co DOT za" <nospam nospam.com> wrote in message news:9m0u9i$13f2$1 digitaldaemon.com...This is because a library should be able to be passed a call-back function whose prototype is not known at the time that the library was compiled. The library should have a run-time facility for calling any function prototype by building the arguments to that function from some kind of template passed to the library. Hence the name "Run-time function call". Interpretors use this facility to great effect. For example: /* this function's prototype was not known as run time */ void foo (char this, int that, float etc); apply (foo, special_arg_list_object); I don't know what's the best way of implementing it.Runtime binding calls style Objective-C syntax, send any message to any ID and if they understand the method, it's taken care of, or otherwise ignored. I agree, if this was present the UI framework design would be far easier. The Cocoa (NextStep) framework in MacOSX is based around this oncept. --Kent
Aug 22 2001