Imports System Imports uCalcSoftware Public Module Program Public Sub GetSetting(ByVal cb As uCalc.Callback) '// Get the name of the setting to retrieve. Dim 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. Dim value = cb.uCalc.EvalStr(settingName) cb.ReturnStr(value) End Sub Public Sub Main() Dim uc As New uCalc() '// 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", AddressOf GetSetting) '// Use the custom function to build a string from the host settings. Console.WriteLine(uc.EvalStr("GetHostSetting('AppName') + ' v' + GetHostSetting('Version')")) End Sub End Module