[Gambas-devel] Concerning Bug(?):signal 6 on adding the function GB.Hook

Benoit Minisini gambas at ...1...
Sat Nov 4 11:28:38 CET 2006


On Saturday 04 November 2006 02:08, chintan rao wrote:
> Hi guys,
> I added GB.Hook function to gb.pcre and gb.imageon including the
> component in the
> gambas program it gave the same error as it gave for my component.
> Thanking you,
> Chintan Rao H

Actually hooks are not automatically chained, so you must do it yourself in 
the hook_main1 function. Otherwise, only the last registered hook will be 
called, and gb.qt will abort if the code in its main hook function is not 
executed.

This is mentioned in the interpreter API doc briefly at 
http://gambasdoc.org//help/api/name/gb.hook.

So you must do:

static void (*old_main_hook)();

static void hook1_main ( int *argc, char **argv )
{
  // call it first, so that main hooks are called in the order
  // of components.

  (*old_main_hook)(argc, argv);

  // ... my code
}

int EXPORT GB_INIT ( void )
{
  old_main_hook = GB.Hook(GB_HOOK_MAIN, (void *)hook1_main);
  return 0;
}

Regards,

-- 
Benoit Minisini





More information about the Devel mailing list