5.6 Compiling Interface and Binary Files for Imports with use

During the development of an IDM application and the usage with source code files, the interface files serve as a representation of the externally available (exported) objects of a module, i.e. the external interface. By separating interface definition and implementation, the IDM is able to load the implementation (that is, the module) only when needed.

With use, this interface definition can also originate directly from the module, i.e. the implementation. For the reason mentioned above it still makes sense to work with interface files though.

For the distribution of an IDM application to the end customer, a binary version of the dialogs and modules is required.

Basically, interface and binary files can be generated the usual way via the commands -writeexport and -writebin. As long as these files with the correct file extension are in the right place within the search path, there is no problem with the use statement.

However, for modularized dialogs that employ use, there are much simpler commands to create all interface and binary files in one step.

-compile

Updates all interface and binary files for modified modules and dialogs.

-recompile

Recreates all interface and binary files.

-cleancompile

Deletes all interface and binary files.

For this the dialog needs to be loaded without errors. Interface and binary files are only created for the specified dialog and all modules loaded per use. No interface and binary files are generated for modules that are accessed via import!

The module and dialog files to be loaded must be available as source code. In case of a loading error, no files will be created.

Example

!! file: Main.dlg

dialog MainDlg

use Models;
use Base.Fonts;

MWiMain WiMain {
  .font Fonts.FnBig;
}
!! file: Models.mod

module ModModels

export window MWiMain {
  on close {
    exit();
  }
}
!! file: Base/Fonts.mod

module ModFonts

export font FnBig "24.Arial";

With the following command all interface and binary files can be created in one step:

pidm -compile Main

Now the following files should lie parallel to the source files:

Main.bin
Models.bin
Models.if
Base/Fonts.bin
Base/Fonts.if

Now if the line export font FnSmall… is added to the file Base/Fonts.mod, simply the following command is used to update:

pidm -compile Main

This causes the following files to be refreshed:

Base/Fonts.bin
Base/Fonts.if

The other interface and binary files are not rewritten because the file date of these files is newer than that of the corresponding source file.

If all interface and binary files should be recreated in any case, this can be achieved with:

pidm -recompile Main

If all interface and binary files should be deleted, this can be done with:

pidm -cleancompile Main

To create the interface and binary files in a different directory, the options -ifdir <directory path> and -bindir <directory path> may be used.