Tech Off Post

Single Post Permalink

View Thread: IL to C++ compiler - Need advice on implementing context switching
  • User profile image
    evildictait​or

    ,BitFlipper wrote

    Edit: I can't make virtual functions static. I don't believe this will be a problem since AFAIC the virtual tables themselves are static, so it doesn't matter if the class instance moves around memory.

    Virtual tables aren't static:

    class myClass {
      int a;
      static int b;
      virtual void myFunc();
      myClass() {}
    }

    looks like this in C:


    static int _myClass_b;
    typedef struct
    {
      int m_a;
      void* myFunc
    } MyClass; 

    void _myClass(MyClass* cls)
    {
      cls->myFunc = &MyClass_myFunc;