Linker

The linker in the Graphical Development Environment automatically receives the options it needs when you choose the Windows executable type. You can control these options; for more information, see “Linking in the Graphical Development Environment” in the Toolkit. However, unlike DOS C applications, Windows applications require a module-definition (.DEF) file. This file

Defines a name for the application.

Marks the application as a Windows application.

Specifies certain attributes of the application, such as whether a data segment is moveable in memory.

Lists and names any callback functions in the application. For more information on callback functions, see “A Windows Application”.

The following is an example of a module-definition file:

NAME Generic WINDOWAPI ; Application's module name

DESCRIPTION 'Sample Microsoft Windows Application'

EXETYPE WINDOWS 3.0 ; Required for all Windows applications

STUB 'WINSTUB.EXE' ; The "stub" displays an error message if

; application is run without Windows

CODE PRELOAD MOVABLE ; Code can be moved in memory

;DATA must be MULTIPLE if program can be invoked more than once

DATA MOVABLE MULTIPLE

HEAPSIZE 1024

STACKSIZE 5120 ; Recommended minimum for Windows applications

; All functions that will be called by any Windows routine

; MUST be exported.

EXPORTS

MainWndProc @1 ; name of window-processing function

AboutDlgProc @2 ; name of About processing function

To link a Windows application, your project (.MAK file) must specify the name of the object files created by the compiler, the name of the Windows import library, the name of the module-definition file, and other options and files.