Re: Functions using variable values
Posted in 1997
ADALBERTO ALTAMIRANO wrote: > > Hi everybody!! > > My question is in regard to the use of functions, specially in running any > function by using variables values; for example : > > FUNCTION name_function() > LET var_name = "action" > CALL var_name > > Well, that's the main idea. > Does anybody have any algorithm to this situation or another idea > to find out my problem ? > We have a solution to this problem, which works fine but is OS-dependent. To cut a long story short, we decided to read the symbolic debug info which is usually attached at the end of the executable (.4ge ). Our programs work fine under SCO 3.2, the only overhead being a delay during program startup, because we cache all the function names, to avoid performance problems during program execution. If you are using the same OS and the same executable format and you are interested, we can send you the C sources, so you can take a closer look. This is a useful technique when it comes to UI, callbacks, event-driven programming, etc. It does have negative sides though and should be used sparingly. Here's how a function is called, using our library: DEFINE Action VARCHAR(30), FuncHandle INTEGER LET Action = "MyFunc" LET FuncHandle = GetFuncId( Action ) ... CALL ExecFuncId( Param1, Param2, Param3, FuncHandle ) You must make sure that MyFunc accepts as many params, as are listed in the call to ExecFuncId. Effectively, Param1, Param2 and Param3 never get popped out of the stack, until the actual call is made to MyFunc. Don't know if this will work with RDS, we're using the compiled version. -------------------------------------------------------------------------- The RATS ( Rapid Application Team of Svilosa ) Bulgaria, Svishtov. --------------------------------------------------------------------------