Execution Model
Files Created by Compilation
- Gnatmake creates the following files
-
Library Information file (eg sayhi.ali): describes when compilation occurred and
any file dependencies
- Object file (eg sayhi.o):
contains non-executable machine code, but does not contain code
for library routines)
- Executable file (sayhi.exe in Windows, sayhi in linux): executable
machine code (all libraries are linked in)
- The .ali and .o files are not needed after the executable is
created.
Linux/Windows Difference: Different Extension for Executable
- Windows executable is
sayhi.exe
- Linux executable is
sayhi
-
sayhi.exe can be run using either sayhi or sayhi.exe
Ada/Java Difference: Case Sensitivity
- The java language is case sensitive, Ada is not
- Linux is case sensitive, windows is not
- The commands
javac and java are case sensitive (even in windows)
- The command
gnatmake expects the filename to be in LOWER CASE (in both
windows and linux)
Linux/Windows Difference: Executables are not Compatible
- Object files and executable files are platform specific.
- Such files created on one platform (eg rucs) will not run on another
platform (eg Intel machines in unix lab)
- If you switch systems you must recompile, as follows: either
- Delete all .o and executable files, then recompile
- Or, if the files are up to date, force recompilation with -f flag (gnatmake -f sayhi)
- This is more of a problem when your program has multiple files so that when
you switch systems you end up with files compiled under different systems
- Different from java: class files will run on any machines. Why?
Ada/Java Difference: Interpretation vs Direct Execution
-
In Java,
javac Hi.java creates file Hi.class file which
you interpret with java Hi
java Hi runs the interpreter on the hardware. The
interpreter takes Hi.class as input and interprets (ie
executes) the
instructions in Hi.class
Hi.class contains java byte code
- In Ada,
gnatmake sayhi creates the executable
sayhi.exe which runs directly on the hardware