Compiling and linking in static mode
The adduser1.com
(Unix) or adduser1.cdm
(Windows)
script, located in the exe folder of the main tmg directory, compiles the user written
subroutines. If there is a local copy of a file with the same name located in the same
directory as the thermal solver input file, the local copy will be used instead. This
permits changes to the standard linking procedure, including the possibility of using a
pre-compiled and linked solver. This allows thermal solver with user written subroutines
to be run on a machine with no local compiler.
On a Windows platform, the adduser1.cmd
file will be modified:
- by removing the line.
rem
rem If a local adduser1 exists it will take precedence.
rem
if exist .\adduser1.cmd .\adduser1.cmd
- by adding a line just before the exit label.
copy t12.exe myuser1.exe
To run .exe file on the machine with no compiler
It is possible to compile and link a user written subroutine on one computer and use it on another computer. This is useful in environments where only some systems have the necessary compilers.
To create a modified executable file that can be used on another machine, the script should be modified to copy t12.exe
to another file, such as myuser1.exe
.
You have to create another version of adduser1
to run on the machine with no compiler. This version removes all of the compilation and linking commands and simply copies myuser1.exe
to t12.exe
. The file myuser1.exe
can be anywhere on the system as long as the path in the file copy command points to the correct location. This second version of adduser1
is placed in the tmg run directory.
When using a pre-built solver that contains the compiled user written subroutine it is still necessary to include a user written subroutine in the tmg input file. It is the presence of this code that triggers the use of the alternate solver. This can be any valid code, including a minimal USER1
subroutine that does nothing.
The adduser1.cmd
file for the system with no compiler:
@echo off
rem
rem Copies myuser1.exe to t12.exe to avoid need to compile code.
rem Assumes myuser1.exe is in run directory.
copy myuser1.exe t12.exe
- The two systems must be running the same version of the operating system. Executables created on one version might not be compatible with another.
- The two systems must be running the same version of thermal solver. Scratch file formats can change between minor releases of tmg and so to ensure success, both systems should be running the same minor version of tmg.