using uCalcSoftware; var uc = new uCalc(); static void GetSetting(uCalc.Callback cb) { // Get the name of the setting to retrieve. var settingName = cb.ArgStr(1); // In a real app, this would read from a config file, database, or registry. // We simulate it by evaluating another variable in the parent uCalc context. var value = cb.uCalc.EvalStr(settingName); cb.ReturnStr(value); } // Simulate a host application's configuration store using uCalc variables. uc.DefineVariable("AppName = 'uCalc Demo'"); uc.DefineVariable("Version = '1.2.3'"); // Define the function that provides a bridge to the 'host'. uc.DefineFunction("GetHostSetting(name As String) As String", GetSetting); // Use the custom function to build a string from the host settings. Console.WriteLine(uc.EvalStr("GetHostSetting('AppName') + ' v' + GetHostSetting('Version')"));