library bde;

uses
{$IFDEF WIN32} FastShareMem, {$ENDIF}
  SysUtils, Classes, Rubies, Pythia, DB,
  DBTables,
  uDBDataSet,
  uBlobStream,
  uDatabase,
  uTable,
  uQuery,
  uStoredProc,
  uSession,
  uSessionList,
  uDefUtils, uRDBExt;

{$E so}

procedure Init_bde;
begin
  if ap_mRDB = 0 then ap_loaderror('undefined RDB module');

  Init_DBDataSet;
  Init_BlobStream;

  Init_Database;
  Init_Table;
  Init_Query;
  Init_StoredProc;
  Init_Session;
  Init_SessionList;
end;

exports
  Init_bde;

exports
  ap_cDatabase,
  ap_iDatabase;

exports
  ap_cSession,
  ap_vSession;

exports
  ap_cSessionList,
  ap_vSessionList;

exports
  ap_cTable,
  ap_iTable;

var
  SaveExit: Pointer;

procedure LibExit;
begin
  Session.Free;
  Session := nil;
  ExitProc := SaveExit;
end;

begin
  SaveExit := ExitProc;
  ExitProc := @LibExit;
end.
