dev • api • name • gb.loadcomponent

GB.LoadComponent

int GB.LoadComponent ( const char *name )

Loads a component.

  • name is the name of the component, like "gb.qt.kde".

This function returns a non-zero value if the component couldn't be loaded.

This function is used for example by the database component to load specific database drivers. Yes, database drivers are components, even if they implement no classes.

Examples

/ * Here Is An extract Of the database component internal function that loads a driver * /

Static DB_DRIVER * DB_GetDriver(char * type)
{
  ...

  char comp[strlen(type) + 8];

  ...

  strcpy(comp, "gb.db.");
  strcat(comp, type);

  If (GB.LoadComponent(comp))
  {
    GB.Error("Cannot find driver for database: &1", type);
    Return Null;
  }

  ...
}

See also