#COMPILE metastatement  

Purpose

Determine what type of file will be created by the compiler.

Syntax

#COMPILE {EXE | SLL} ["filename{.exe|.sll}"]

Remarks

This metastatement is used to specify whether a module is to be compiled as an EXE or SLL file. The #COMPILE metastatement can only be used once per program, and must be placed before any executable code.

You may, optionally, specify the target name and path of the file.  If the optional equal sign (=) is included, the name given is considered to be an exact name, and nothing is appended or changed.  Otherwise, the file type is forced to be EXE or SLL by the compiler.

If the filename clause is omitted, the compiled file is given the name of the main source code file with an appropriate extension.

If a path is included, the compiled file is placed in the named directory; otherwise, it is placed in the current directory.

If the named directory does not exist, the filename is invalid or locked, if the EXE is still running, or if the file cannot be successfully stored in that location for some other reason, a compile-time Error 496 ("Destination file write error") occurs.

A related item is the built-in numeric equate %PB_COMPILETIME.  Each time you compile your program, this equate is filled with the current date and time of the compilation in PowerTime binary format.  You can use the PowerTIME Class to convert it to a text equivalent for use in your application.

Restrictions

If #COMPILE is not specified, the default is #COMPILE EXE.

Examples

#COMPILE EXE ' Same name as source, i.e., ABC.EXE

#COMPILE SLL "ABC" ' Compiles to ABC.SLL

#COMPILE EXE "ABC.BAS" ' Compiles to ABC.BAS.EXE

See also

%PB_COMPILETIME, #COMPILER, DLLMAIN, LIBMAIN, PBLIBMAIN, PBMAIN, WINMAIN