On 10/2/2016 8:50 PM, Jacob wrote:
    import std.stdio;

    struct SomeStruct
    {
        int value;

        void func()
        {
            writeln(value);
        }

    }

    void main()
    {
        SomeStruct someStruct;
        someStruct.value = 333;

        auto func = cast(void function(ref SomeStruct))&SomeStruct.func;

        func(someStruct);
    }

Has worked so far for me.

That's cool, but it does rely on the ABI of regular functions matching that of member functions, which isn't true on all platforms.

Reply via email to