文档中的例子可能是用SDK编制的,我不是很清楚,不过你可以参考
ibintf.pas自已编一个,也不难,我写了一个,供参考:
unit main;
interface
uses
Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs,
StdCtrls,ibexternals,ibheader;
type
TForm1 = class(TForm)
Button1: TButton;
procedure Button1Click(Sender: TObject);
procedure FormCreate(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;
var
Form1: TForm1;
IBLibrary: THandle;
isc_add_user:Tisc_add_user;
implementation
{$R *.DFM}
procedure TForm1.Button1Click(Sender: TObject);
var
userData: TUserSecData;
userDataPtr: PUserSecData;
status: array[0..19] of ISC_STATUS;
isc_status: PISC_STATUS;
begin
{ setup isc_status pointer }
isc_status := @status;
{ setup user data pointer to point to user data structure }
userDataPtr := @userData;
{ setup user data structure }
userData.user_name := 'BJONES';
userData.password := 'bjones';
userData.protocol := sec_protocol_local;
userData.dba_user_name := 'SYSDBA';
userData.dba_password := 'masterkey'; // Don't hardcode this */
userData.first_name := 'Bobby';
userData.last_name := 'Jones';
userData.sec_flags := sec_password_spec or sec_dba_user_name_spec or
sec_dba_password_spec
or sec_first_name_spec or sec_last_name_spec;
{ add user to security database }
isc_add_user(isc_status, userDataPtr);
end;
procedure TForm1.FormCreate(Sender: TObject);
function GetProcAddr(ProcName: PChar): Pointer;
begin
Result := GetProcAddress(IBLibrary, ProcName);
if not Assigned(Result) then
RaiseLastWin32Error;
end;
begin
IBLibrary := LoadLibrary(PChar(IBASE_DLL));
isc_add_user := GetProcAddr('isc_add_user'); {do not localize}
end;
end.
注:IBASE_DLL在IBHEARD中有定义,为gds32.dll