compile
| compile | 
  Purpose
 
  Synopsis
 
function compile(src:string):integer
 function compile(opt:string, src:string):integer
 function compile(opt:string, src:string, dst: string):integer
 function compile(opt:string, src:string, dst: string, com:string, pwd:string, pke:string, kls:string):integer
 function compile(mi:Mosel, opt:string, src:string, dst: string):integer
 function compile(mi:Mosel, opt:string, src:string, dst: string, com:string, pwd:string, pke:string, kls:string):integer
 
  Arguments
 
| 
     opt 
     | 
     Compilation options (may be separated by spaces or
     '-' symbols):
     
 | ||||||||||||||||||||||
| 
     src 
     | 
     Source file name
     | ||||||||||||||||||||||
| 
     dst 
     | 
     Destination file name
     | ||||||||||||||||||||||
| 
     com 
     | 
     Comment to store in the bim file
     | ||||||||||||||||||||||
| 
     mi 
     | 
     The Mosel instance to perform the compilation
     | ||||||||||||||||||||||
| 
     pass 
     | 
     Password or password file (for encryption with a password)
     | ||||||||||||||||||||||
| 
     pke 
     | 
     Private key file (for bim file signing)
     | ||||||||||||||||||||||
| 
     kls 
     | 
     File of public keys (for encryption with public keys)
     | 
  Return value
 
| 
     0 
     | 
     Function executed successfully
     | 
| 
     1 
     | 
     Parsing phase has failed (syntax error or file access error)
     | 
| 
     2 
     | 
     Error in compilation phase (a semantic error has been detected)
     | 
| 
     3 
     | 
     Error writing the output file
     | 
| 
     4 
     | 
     License error (compiler not authorized)
     | 
  Example
 
 Compile the local file
 "src.mos" stored on the current directory using the instance
 inst1 and store the resulting BIM file on the current directory of this instance:
 
r:=compile(ins1,"","rmt:src.mos","dst.bim")
  Further information
 
 1. This function compiles a given model source file into a binary model file (bim file) that is required as input to function
 load for executing the model.
 
 2. If no destination file name is provided, the output file takes the same name as the source file with the extension
 .bim.
 
 3. When sending a compilation request to a separate Mosel instance, it is important to keep in mind that the operation is performed in the environment of this instance (in particular its current working directory) and file names should be specified appropriately (the
 rmt: IO driver can be particularly helpful in this context).
 
 4. The argument
 kls is a list of public key files (
 i.e. each line of the file is a key file name): when encrypting a file, the encryption is performed for each of the listed public keys such that the bim file can be decrypted by any of the corresponding private keys.
 
 5. When prefixes provided via
 bx or
 ix are quoted with double quotes, backslashes are interpreted such that special characters can be included in the string. It is therefore required to double this symbol when it has to be included (
 e.g.
 'bx="C:\\mydir"').
 
  Related topics
 
 load.
 
  Module
 
 
