# GB.Post

`void GB.Post ( void ( * func )() , long param )`

Post a callback routine that will be called at the next event loop.

- func is the address of the callback.
- param is a long integer that will be pass to the callback.

Use this function if you can't execute a piece of code immediately.

But be careful : if you want to use an object in the callback, reference it with GB.Ref, to prevent the interpreter destroying it before the callback is called.

For example, `GB.Post` is used for raising `Click` events when you select a menu, because raising the event immediately in the `QT` slot crashes the interpreter !

This function calls the post interpreter hook so that it knows that a new post routine has been registered.

Example :

      /* This is how menu event are sent in the QT component */

      static void send_menu_event(CMENU *menu)
      {
        GB.Raise(menu, EVENT_Click, 0);
        GB.Unref((void **)&menu);
      }

      void CMenu::activated(int id)
      {
        CMENU *menu = ... ;

        // Don't send the event immediately
        // GB.Raise(menu, EVENT_Click, NULL);

        GB.Ref(menu);
        GB.Post((void (*)())send_menu_event, (long)menu);
      }