Well, let me put it this way. Ever since learning Caml, I've found it quite annoying to write in any language that didn't have closures (never mind that it has a positively beautiful standard library).
Sure, you could implement a lookup table that lets you remap global function names to specific calls. In C, it would not be that hard. But it would be very lightly troublesome because of typecasting issues. A macro could be constructed, however, to half-wrap this.
// Generic function typetypedef void (*TBENT)( void );typedef char *FNNAME;// Implement a name->TBENT map of some sort.void setFunction( FNNAME, TBENT );TBENT getFunction( FNNAME );// Define a "foo"int foo_0 ( int a, float b ) { return (int)( (float)(a * a) / b );}// Register "foo"setFunction("foo", foo_0);// To call a function "foo" which takes an int and a float, returns an int...int myRet0 = (int (*)(int, float))getFunction("foo")(9, 18);// myRet0 is now 4int foo_1 ( int a, float b ) { return a * (int)b;}// Register "foo"setFunction("foo", foo_0);// Call again.int myRet1 = (int (*)(int, float))getFunction("foo")(9, 18);// myRet1 is now 162.
Now, would you want to? Not really, for any purpose other than virtual machines, interactive-parsed languages, and scripting. There are cleaner solutions for everything else.
RIP GameDev.net: launched 2 unusably-broken forum engines in as many years, and now has ceased operating as a forum at all, happy to remain naught but an advertising platform with an attached social media presense, headed by a staff who by their own admission have no idea what their userbase wants or expects.Here's to the good times; shame they exist in the past.