Question

I have been trying to compile an asm file with tasm running on windows XP.

Tasm32 version - Turbo Assembler Version 5.0 Copyright (c) 1988, 1996 Borland International

Turbo Link Version 1.6.71.0 Copyright (c) 1993,1996 Borland International

With my current directory set to tasm\bin I have been able to do the following-

TASM32 /m29A /ml filename.asm

This generates the normal .Obj file. So far so good. Then I try to link using -

TLINK32 -Tpe -aa -x filename.obj,,,"kernel32.lib"

I am using the appropriate path to the kernel32.lib

But it is throwing up the following errors -

Fatal: Unable to open file 'filename.obj,,,C:\Program Files\Microsoft SDKs\Windo ws\v6.0A\Lib\Kernel32.lib'

I have very little knowledge of asm and did Google around for a solution but I can't seem to find one. It seems that the linker is taking everything to be one single file.

Any help will be appreciated as I am completely at sea how to solve this.

Thank you.

Was it helpful?

Solution

I have Borland C++ Builder 5 installed, which includes tasm32 and tlink32. The command-line options for TASM32 print as follows:

Turbo Assembler  Version 5.3  Copyright (c) 1988, 2000 Inprise Corporation
Syntax:  TASM [options] source [,object] [,listing] [,xref]
/a,/s          Alphabetic or Source-code segment ordering
/c             Generate cross-reference in listing
/dSYM[=VAL]    Define symbol SYM = 0, or = value VAL
/e,/r          Emulated or Real floating-point instructions
/h,/?          Display this help screen
/iPATH         Search PATH for include files
/jCMD          Jam in an assembler directive CMD (eg. /jIDEAL)
/kh#           Hash table capacity # symbols
/l,/la         Generate listing: l=normal listing, la=expanded listing
/ml,/mx,/mu    Case sensitivity on symbols: ml=all, mx=globals, mu=none
/mv#           Set maximum valid length for symbols
/m#            Allow # multiple passes to resolve forward references
/n             Suppress symbol tables in listing
/os,/o,/op,/oi Object code: standard, standard w/overlays, Phar Lap, IBM
/p             Check for code segment overrides in protected mode
/q             Suppress OBJ records not needed for linking
/t             Suppress messages if successful assembly
/uxxxx         Set version emulation, version xxxx
/w0,/w1,/w2    Set warning level: w0=none, w1=w2=warnings on
/w-xxx,/w+xxx  Disable (-) or enable (+) warning xxx
/x             Include false conditionals in listing
/z             Display source line with error message
/zi,/zd,/zn    Debug info: zi=full, zd=line numbers only, zn=none

The command-line options for TLINK32 print as follows:

Turbo Link  Version 2.5.0.0 Copyright (c) 1993,1998 Borland International
Syntax: TLINK32 objfiles, exefile, mapfile, libfiles, deffile, resfiles
@xxxx indicates use response file xxxx
  -m      Map file with publics     -x       No map
  -s      Detailed segment map      -L       Specify library search paths
  -M      Map with mangled names    -j       Specify object search paths
  -c      Case sensitive link       -v       Full symbolic debug information
  -Enn    Max number of errors      -n       No default libraries
  -P-     Disable code packing      -H:xxxx  Specify app heap reserve size
  -OS     Do smart linking
  -B:xxxx Specify image base addr   -Hc:xxxx Specify app heap commit size
  -wxxx   Warning control           -S:xxxx  Specify app stack reserve size
  -Txx    Specify output file type  -Sc:xxxx Specify app stack commit size
      -Tpx  PE image            -Af:nnnn Specify file alignment
        (x: e=EXE, d=DLL)   -Ao:nnnn Specify object alignment
  -ax     Specify application type  -o       Import by ordinals
      -ap Windowing Compatible  -Vd.d    Specify Windows version
      -aa Uses Windowing API    -r       Verbose link

So your linker command line

TLINK32 -Tpe -aa -x filename.obj,,,"kernel32.lib"

has the following options: -Tpe means output file type PE exe, -aa means application type "uses Windowing API", -x means no map. Since the -n option was not specified, the default runtime libraries will be included.

Then there are six lists of filenames. The lists are separated by commas. The filenames are separated by spaces if I remember correctly.

Currently you have objfiles = filename.obj, resfiles=kernel32.lib, and the other four lists of filenames are empty. I think you actually mean kernel32.lib to be in the list of libfiles. Try this:

TLINK32 -Tpe -aa -x filename.obj, , , kernel32.lib, , 

This project will be easier to build and maintain if you create a makefile, because all it takes is one extra comma to make the linker stage fail. You've already experienced the frustration of trying to debug a mysterious build recipie.

# makefile for Borland make
# *** not tested yet!  no source code.
# Not compatible with nmake.
# May be compatible with gnu make.
#
# Borland Turbo Assembler
$(TASM32)=TASM32.exe
$(TASM32FLAGS)=/m29A /ml
#
# Borland Turbo Link
$(TLINK32)=TLINK32.exe
$(TLINK32FLAGS)=-Tpe -aa -x
#
# objfiles
$(OBJ)=filename.obj
#
# exefile
$(BIN)=filename.exe
#
# mapfile
$(MAP)=
#
# libfiles
$(LIBS)=kernel32.lib
#
# deffile
$(DEF)=
#
# resfiles
$(RES)=

all: all-before $(BIN) all-after

$(BIN): filename.asm


# Turbo Assembler  Version 5.3  Copyright (c) 1988, 2000 Inprise Corporation
# Syntax:  TASM [options] source [,object] [,listing] [,xref]
.asm.o:
    $(TASM32) $(TASM32FLAGS) $<

# Turbo Link  Version 2.5.0.0 Copyright (c) 1993,1998 Borland International
# Syntax: TLINK32 objfiles, exefile, mapfile, libfiles, deffile, resfiles
# Note the commas separate the lists of filenames, not the filenames themselves
$(BIN): $(OBJ)
    $(TLINK32) $(TLINK32FLAGS) $(OBJ), $(BIN), $(MAP), $(LIBS), $(DEF), $(RES)

Sorry this is about as far as I can get with this question, there's not much here that I can actually test. Hopefully this is enough to get your build on the right track. Good luck!

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top