Please remember this is a work in progress. Home » Deployment

Deployment

 

Changing Project Type

 

Since IntraWeb 15 there are 4 different project types: Stand Alone Indy-based (SA-Indy), Stand Alone Http.sys (SA-HSys), ISAPI and IW Lib (for ASPX Deployment). We recommend you to use the SA-Indy type of project for development and basic testing of your application. Once the application is ready for deployment (or at least in beta stage), you can then test it in the actual scenario and see how it works. This way, most IntraWeb applications are born as SA and later the develooper needs to change the project type. Here's how you can do it:

1) This is a minimal SA project (Indy):

program MyProject;

uses
  IWRtlFix,
  Forms,
  IWStart,
  Unit1 in 'Unit1.pas' {IWForm8: TIWAppForm},
  ServerController in 'ServerController.pas' {IWServerController: TIWServerControllerBase},
  UserSessionUnit in 'UserSessionUnit.pas' {IWUserSession: TIWUserSessionBase};

{$R *.res}

begin
  TIWStart.Execute(True);
end.


2) This is a minimal SA project (Http.sys):

program MyProject;

uses
  IWRtlFix,
  Forms,
  IWStartHSys,
  Unit1 in 'Unit1.pas' {IWForm8: TIWAppForm},
  ServerController in 'ServerController.pas' {IWServerController: TIWServerControllerBase},
  UserSessionUnit in 'UserSessionUnit.pas' {IWUserSession: TIWUserSessionBase};

{$R *.res}

begin
  TIWStartHSys.Execute(True);
end.


3) This is a minimal ISAPI project:

library MyProject;

uses
  IWRtlFix,
  ISAPIApp,
  IWInitISAPI,
  Unit1 in 'Unit1.pas' {IWForm7: TIWAppForm},
  ServerController in 'ServerController.pas' {IWServerController: TIWServerControllerBase},
  UserSessionUnit in 'UserSessionUnit.pas' {IWUserSession: TIWUserSessionBase};

{$R *.RES}

exports
  GetExtensionVersion,
  HttpExtensionProc,
  TerminateExtension;

begin
  IWRun;
end.


4) And finally, a minimal IW Lib project:

library MyProject;

uses
  IWRtlFix,
  IWRtlFix,
  IW.Export,
  Unit1 in 'Unit1.pas' {IWForm7: TIWAppForm},
  ServerController in 'ServerController.pas' {IWServerController: TIWServerControllerBase},
  UserSessionUnit in 'UserSessionUnit.pas' {IWUserSession: TIWUserSessionBase};

{$R *.RES}

begin

end.


You could create a single source file able to compile all 3 types of projects, using conditional compiler directives ($IFDEFS}, although the lack of IDE support does not make it very practical:

{$DEFINE SA_Indy}
{.$DEFINE SA_HSys}
{.$DEFINE ISAPI}
{.$DEFINE IWLIB}
{$IFDEF SA_Indy} {$DEFINE SA} {$ENDIF}
{$IFDEF SA_HSys} {$DEFINE SA} {$ENDIF}


{$IFDEF SA}
program MyProject;
{$ELSE}
library MyProject;
{$ENDIF}

uses
  IWRtlFix,
  Forms,
  {$IFDEF SA_Indy} IWStart, {$ENDIF}
  {$IFDEF SA_HSys} IWStartHSys, {$ENDIF}
  {$IFDEF ISAPI} ISAPIApp, IWInitISAPI, {$ENDIF}
  {$IFDEF IWLIB} IW.Export, {$ENDIF}
  UTF8ContentParser,
  Unit1 in 'Unit1.pas' {IWForm8: TIWAppForm},
  ServerController in 'ServerController.pas' {IWServerController: TIWServerControllerBase},
  UserSessionUnit in 'UserSessionUnit.pas' {IWUserSession: TIWUserSessionBase};

{$R *.res}

{$IFDEF ISAPI}
exports
  GetExtensionVersion,
  HttpExtensionProc,
  TerminateExtension;
{$ENDIF}

begin
  {$IFDEF ISAPI}
  IWRun;
  {$ELSE}
    {$IFDEF SA_Indy}
    TIWStart.Execute(True);
    {$ELSEIF SA_HSys}
    TIWStartHSys.Execute(True);
    {$IFEND}
  {$ENDIF}
end.

If you want to deploy as ISAPI, just add a dot in front of {$DEFINE SA} compiler directive (it then becomes {.$DEFINE SA}), and remove the dot in front of {.$DEFINE ISAPI} (it then becomes {$DEFINE ISAPI}), and you are done. Unfortunately, there are a few issues with this approach: Delphi IDE doesn't handle {$IFDEFs} inside .DPR files well. For instance, even when you change it from "program MyProject" to "library MyProject", the Delphi IDE still thinks that you have an EXE file. In fact most versions of Delphi will correctly create the associated binary file (EXE or DLL), but I suggest you to test it using your version of Delphi/RAD Studio.

You may also create 2 different projects, one for SA and other for ISAPI or IWLib. The drawback is that everytime you add or remove a unit to/from your project (or change some global option), you have do do it in both projects.

 

Terms of Use | Privacy Statement © 2002 - 2024 Atozed Software