Standalone Server / ISAPI Module Project

This type of project is a combo project using conditional compilation for creating one of two types: Standalone server or ISAPI Modulearrow-up-right. This template is useful if ISAPI Module deployment will be targeted for production use. You can convert your Standalone server to an ISAPI DLL by simply commenting out the first line of the DPR file. Also see Deployment Optionsarrow-up-right.

Example DPR file:

{$define UNIGUI_VCL} // Comment out this line to turn this project into an ISAPI module'

{$ifndef UNIGUI_VCL}
library
{$else}
program
{$endif}

Project1;

uses
  uniGUIISAPI,
  Forms,
  ServerModule in 'ServerModule.pas' {UniServerModule: TUniGUIServerModule},
  MainModule in 'MainModule.pas' {UniMainModule: TUniGUIMainModule},
  Main in 'Main.pas' {MainForm: TUniForm};

{$R *.res}

{$ifndef UNIGUI_VCL}
exports
  GetExtensionVersion,
  HttpExtensionProc,
  TerminateExtension;
{$endif}

begin
  {$ifdef UNIGUI_VCL}
  Application.Initialize;
  TUniServerModule.Create(Application);
  Application.Run;
  {$endif}
end.

By default the above project produces an EXE file (Standalone server). If you comment out the first line of the project it will turn into an ISAPI module. You can later convert it back to Standalone EXE mode by removing the comment from the first line.

1

Convert a combo project to an ISAPI DLL

Open the DPR file and follow these steps:

  • Change the first line of the DPR file to: {.$define UNIGUI_VCL}

  • If your Delphi edition is XE2 or newer, close the project and open it again. (This is not needed for Delphi versions older than XE2.)

  • Build your application.

  • A DLL file will be created in the output folder.

2

Convert a combo project back to Standalone mode

Open the DPR file and follow these steps:

  • Change the first line of the DPR file to: {$define UNIGUI_VCL}

  • If your Delphi edition is XE2 or newer, close the project and open it again. (This is not needed for Delphi versions older than XE2.)

  • Build your application.

  • Your project will be compiled to an EXE file again.