Home > dev > api > name > gb.loadcomponent 
 fr de es it nl pl pt pt_BR mk sq ca hu cs tr ar fa id vi ko ja ru zh zh_TW eo
Previous  Next  Edit  Rename  Undo  Refresh  Search  Administration  
Documentation
History
 
GB.LoadComponent
int GB.LoadComponent ( const char *name )

Loads a component.

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.

Example

/* 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

api/cat/component