Skip to content

LoadSymbol

Jiowcl edited this page May 10, 2020 · 4 revisions

LoadSymbol

Creates e new keyword inside interpreter.

public class Program
{
    public delegate void MyNewFunction1Delegate();
    public delegate void MyNewFunction2Delegate();

    static void MyNewFunction1()
    {
        Console.Write("Callback 1 called");
    }

    static void MyNewFunction2()
    {
        Console.Write("Callback 2 called");
    }

    static void Main(string[] args)
    {
        int hThin = Thinbasic.Init(0, 0, "thinbasic");

        MyNewFunction1Delegate del1 = new MyNewFunction1Delegate(MyNewFunction1);
        MyNewFunction2Delegate del2 = new MyNewFunction2Delegate(MyNewFunction2);

        Thinbasic.LoadSymbol("MyNewFunction1", (int) Enums.ReturnType.None, Marshal.GetFunctionPointerForDelegate(del1), Enums.ForceOverWrite);
        Thinbasic.LoadSymbol("MyNewFunction2", (int)Enums.ReturnType.None, Marshal.GetFunctionPointerForDelegate(del2), Enums.ForceOverWrite);

        Thinbasic.Release(0);
    }
}

LoadSymbolEx

Creates e new keyword inside interpreter.

public class Program
{
    public delegate void MyNewFunction1Delegate();
    public delegate void MyNewFunction2Delegate();

    static void MyNewFunction1()
    {
        Console.Write("Callback 1 called");
    }

    static void MyNewFunction2()
    {
        Console.Write("Callback 2 called");
    }

    static void Main(string[] args)
    {
        int hThin = Thinbasic.Init(0, 0, "thinbasic");

        MyNewFunction1Delegate del1 = new MyNewFunction1Delegate(MyNewFunction1);
        MyNewFunction2Delegate del2 = new MyNewFunction2Delegate(MyNewFunction2);

        Thinbasic.LoadSymbolEx("MyNewFunction1", (int) Enums.ReturnType.None, Marshal.GetFunctionPointerForDelegate(del1), Enums.ForceOverWrite, "MyNewFunction1Syntax", "MyNewFunction1Help");
        Thinbasic.LoadSymbolEx("MyNewFunction2", (int)Enums.ReturnType.None, Marshal.GetFunctionPointerForDelegate(del2), Enums.ForceOverWrite, "MyNewFunction1Syntax", "MyNewFunction1Help");

        Thinbasic.Release(0);
    }
}
Clone this wiki locally