Subject RE: [IBO] TIB_Session in ISAPI DLL
Author IBO Support List
There's probably a better way to accomplish this but I'd need to know more of what you are trying to do to give you some advice there.
 
What's the callstack of the exception?
 
Jason


From: IBObjects@yahoogroups.com [mailto:IBObjects@yahoogroups.com]
Sent: Thursday, June 19, 2014 10:04 AM
To: IBObjects@yahoogroups.com
Subject: RE: [IBO] TIB_Session in ISAPI DLL

I get an Access Violation because WebModule2=nil. To try to address this I moved the definitions to the TWebModule2 unit, but it didn't help - the library unit consists of (essentially)
begin
  CoInitFlags := COINIT_MULTITHREADED;
  Application.Initialize;
  Application.CreateForm(TWebModule2, WebModule2);
  Application.Run;
end.

The TWebModule2 unit now looks like this:

unit webint;
interface
uses ...

type
    TAS_IBODatabase = class(TIBODatabase)
    private
    public
        constructor Create(anOwner: TComponent); override;
    end;

    TAS_IBOQuery = class(TIBOQuery)
    private
    public
        procedure Open;
        constructor Create(anOwner: TComponent); override;
&n! bsp;   end;

  TWebModule2 = class(TWebModule)
     AS_DLL_SESSION: TIB_Session;
     AS_DLL_TRANSACTION: TIBOTransaction;
     procedure WebModule2USERLISTAction(Sender: TObject; Request: TWebRequest; Response: TWebResponse; var Handled: Boolean);
    ...
   end;

var
  WebModule2: TWebModule2;

implementation

uses ...

constructor TAS_IBODatabase.Create(anOwner: TComponent);
begin
    inherited Create(anOwner);
    if Assigned(WebModule2) then
        WriteErMsg('WebModule2 IS assigned')
    else
        WriteErMsg('WebModule2 IS NOT assigned');

    IB_Session := WebModule2.AS_DLL_Session;  {Generates AV}
    WriteErMsg('Successfully ex! ecuted "IB_Session:= WebModule2.AS_DLL_Session"');
en d;

procedure TWebModule2.WebModule2USERLISTAction(Sender: TObject;
  Request: TWebRequest; Response: TWebResponse; var Handled: Boolean);
...