If you do have an Intel syntax compatible assembler (such as Turbo Assembler or Microsoft Macro Assembler), you can use the makefile in the 32_vc package as a template. You will also need all the *.lnk, *.h, *.cpp, *.inc and *.asm files in the 32_vc.zip package. Alternatively, you can try to use the files from the 32_bcc32.zip package as a template.
CC = g++
The AS parameter in the makefile specifies the assembler executable name. It is only needed if you are using the .asm files of an apfloat platform package and the assembler executable name is different from the C++ compiler. With Microsoft C++ you must use the separate ml command, whereas Borland C++ knows to automatically compile .asm files with Turbo Assembler.
AS = ml
CONV1 = strip CONV2 = true
RM = rm -f ARADD = ar rc RANLIB = ranlib
These parameters define the file extensions for all the needed file types, and the ios flag that is used to determine that files are opened in binary mode (instead of text mode).
|C||Extension for C++ source files. On Unix systems typically .cc, on DOS/Windows .cpp. Note that the source files in the apfloat packages have a .cpp extension so if this is something else than .cpp, you will need to rename the files to the appropriate extension.|
|S||Assembler source file extension. Not needed on Unix systems, on DOS/Windows typically .asm.|
|OBJ||Extension of object files. With Unix and djgpp this is usually .o, with DOS/Windows compilers typically .obj.|
|OUT||Extension of the executable file generated by the linker. On Unix systems and with djgpp in DOS this is empty. With most other MS-DOS/Windows compilers this is .exe.|
|EXE||Extension of the (final, actual) excutable file. On Unix systems this is typically empty. With most MS-DOS/Windows compilers this is .exe. This is only different from the OUT parameter if some post-link processing needs to be done (with the CONV1 and CONV2 commands) that create an executable file from the linker output, which is the case for example with djgpp.|
|BIN||Name of the ios flag that defines that a file is opened in binary mode (instead of text mode). This is really only needed in MS-DOS and Windows, where there is a difference in handling the line feed character (in text mode it is translated to a carriage return/line feed pair which corrupts binary data). On Unix systems (including Linux) this should not be needed as no such translation is done and all files are always opened in binary mode. In DOS/Windows the flag is usually "binary", although some compilers seem to use "bin". In many Unix systems this flag does not exist at all; in this case you can just use "in". The flag is used in the apfloat source code as ios::BIN, that is for example ios::binary if BIN is defined as binary.|
|LIBPRE||Object library file prefix. With Unix compilers you may want to set this to "lib", if you want to name the library "libapfloat.a", so that you can compile it to your programs using "-lapfloat". With MS-DOS/Windows compilers leave this setting empty.|
|LIBEXT||Object library file extension. With Unix compilers (including djgpp) this is usually ".a", with most MS-DOS/Windows compilers ".lib".|
C = .cpp S = .asm OBJ = .obj OUT = .exe EXE = .exe BIN = binary LIBPRE = LIBEXT = .lib
OPTS = -mips3 -mlong64 -O3 -ffast-math -w
ASOPTS defines compilation options that are passed to the assembler (AS), similarly as the OPTS parameter defines compilation options that are passed to the C++ compiler. ASOPTS is only needed if you use a separate assembler (defined by the parameter AS).
ASOPTS = /coff /Zi
For example (note the space after the -o):
OUTOPT = -o
DEFOPT = -D
If you use an assembler-optimized version, make sure that the ASM line in the makefile is NOT commented out. That is the line should be "ASM = $(DEFOPT)ASM". If you use a version that has no assembler functions, comment the line out (like "#ASM = $(DEFOPT)ASM") or delete the line.
# Comment do disable assembler optimizations #ASM = $(DEFOPT)ASM
COMPOPT = $(DEFOPT)BIN=$(BIN) $(ASM) -c
Apfloat calls a function called "truncate" to shrink a file's size. Some compilers have this function in their standard C library. If a truncation function by that name does not exist, apfloat has a dummy truncation function that doesn't do anything, and you should use that to be able to link the program. It does no harm to actually not truncate a file, it just takes unnecessary disk space during run time. The dummy truncate.c file is in the apfloat common source files package.
You can of course implement your own truncate function to truncate a file using your compiler's specific method. With most MS-DOS/Windows compilers you might be able to do this using the truncate.c file in the 32_vc.zip or 32_bcc32.zip package.
If your compiler has a built-in truncate function (gcc has it, including djgpp), be sure to comment out the TRUNCATE line in the makefile. That is the line should be "#TRUNCATE = truncate$(OBJ)". If your compiler does NOT have a built-in function named truncate, the TRUNCATE line should be uncommented, that is "TRUNCATE = truncate$(OBJ)".
# Uncomment if your compiler doesn't have the truncate function #TRUNCATE = truncate$(OBJ)
LIBS = -lm
The .asm files in the 32_vc package all include the cpp.inc file. This file defines what the actual names of various C++ global variables are. Some compilers, such as Borland C++, keep the names the same (prefixing an underscore), so that for example the variable Base can be accessed as _Base in assembler programs. Other compilers, such as Microsoft Visual C++, "mangle" the global variable names so that for example Base can be accessed as ?Base@@3IA in assembler programs.
Depending on your compiler the mangled names could be anything, so you can specify them in the cpp.inc file. The assembler source code uses underscore prefixed variable names.
To figure out the mangled names you need to write a dummy C++ program that references all the variables and have the compiler generate assembler source for the dummy program. Then find the variable names in the generated assembly code.
Last updated: October 22nd, 2000