Each time you compile a source file, you can specify a floating-point option. When you link two or more source files to produce an executable program file, you must ensure that floating-point operations are handled consistently and that the environment is set up properly to allow the linker to find the required library.
If you are building libraries of C or C++ routines that contain floating-point operations, the calls to emulator option (/FPc) provides the most flexibility.
The examples that follow illustrate how you can link your program with a library other than the default. The floating-point option and the substitute library are compatible.
The example below compiles the program CALC.C with the medium-model option (/AM). Because no floating-point option is specified, the default inline emulator option (/FPi) is used. The inline emulator option generates 80x87 instructions and specifies the emulator library MLIBCE.LIB in the object file. The /LINK field specifies the /NODEFAULTLIBRARYSEARCH (/NOD) option and the names of the medium-model math coprocessor library. Specifying the math coprocessor library forces the program to use an 80x87 coprocessor; the program fails if a coprocessor is not present.
CL /AM CALC.C /link MLIBC7 /NOD
The example below compiles CALC.C using the small (default) memory model and the alternate math option (/FPa). The /LINK field specifies the /NOD option and the library SLIBCE.LIB. Specifying the emulator library causes all floating-point calls to refer to the emulator library instead of to the alternate math library.
CL /FPa CALC.C /link SLIBCE /NOD
The example below compiles CALC.C with the calls to math coprocessor option (/FPc87), which places the library name SLIBC7.LIB in the object file. The /LINK field overrides this default-library specification by giving the /NOD option and the name of the small-model alternate math library (SLIBCA.LIB).
CL /FPc87 CALC.C /link SLIBCA.LIB/NOD