Vinculación de programas
Frecuentes
Visto 1,232 veces
0
He estado tratando de compilar un archivo asm con tasm ejecutándose en Windows XP.
versión tasm32 - Turbo Assembler Version 5.0 Copyright (c) 1988, 1996 Borland International
Turbo Link Version 1.6.71.0 Copyright (c) 1993,1996 Borland International
Con mi directorio actual establecido en tasm\bin
He sido capaz de hacer lo siguiente-
TASM32 /m29A /ml filename.asm
Esto genera el archivo .Obj normal. Hasta ahora, todo bien. Luego trato de vincular usando -
TLINK32 -Tpe -aa -x filename.obj,,,"kernel32.lib"
Estoy usando la ruta adecuada a kernel32.lib
Pero está arrojando los siguientes errores:
Fatal: Unable to open file 'filename.obj,,,C:\Program Files\Microsoft SDKs\Windo
ws\v6.0A\Lib\Kernel32.lib'
Tengo muy poco conocimiento de asm y busqué en Google una solución, pero parece que no puedo encontrar una. Parece que el enlazador está tomando todo como un solo archivo.
Cualquier ayuda será apreciada ya que estoy completamente en el mar sobre cómo resolver esto.
Gracias por su atención.
1 Respuestas
1
Tengo instalado Borland C++ Builder 5, que incluye tasm32 y tlink32. Las opciones de línea de comandos para TASM32 se imprimen de la siguiente manera:
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
Las opciones de línea de comandos para TLINK32 se imprimen de la siguiente manera:
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
Así que su línea de comando del enlazador
TLINK32 -Tpe -aa -x filename.obj,,,"kernel32.lib"
tiene las siguientes opciones: -Tpe significa tipo de archivo de salida PE exe, -aa significa tipo de aplicación "usa API de ventanas", -x significa sin mapa. Dado que no se especificó la opción -n, se incluirán las bibliotecas de tiempo de ejecución predeterminadas.
Luego hay seis listas de nombres de archivo. Las listas están separadas por comas. Los nombres de archivo están separados por espacios si no recuerdo mal.
Actualmente tiene objfiles = filename.obj, resfiles=kernel32.lib, y las otras cuatro listas de nombres de archivo están vacías. Creo que en realidad quiere decir que kernel32.lib esté en la lista de archivos lib. Prueba esto:
TLINK32 -Tpe -aa -x filename.obj, , , kernel32.lib, ,
Este proyecto será más fácil de compilar y mantener si crea un archivo MAKE, porque todo lo que se necesita es una coma adicional para que la etapa del enlazador falle. Ya ha experimentado la frustración de intentar depurar una receta de compilación misteriosa.
# 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)
Lo siento, esto es lo más lejos que puedo llegar con esta pregunta, no hay mucho aquí que realmente pueda probar. Esperemos que esto sea suficiente para que su compilación esté en el camino correcto. ¡Buena suerte!
Respondido el 02 de diciembre de 13 a las 09:12
No es la respuesta que estás buscando? Examinar otras preguntas etiquetadas c assembly tasm or haz tu propia pregunta.
¿Para qué son esas comas ahí? - Michael
No tengo ni idea. Supongo que eran para parámetros vacíos. El escritor del código dejó estas instrucciones. Vi estas comas cuando busqué en Google, así que asumí que podría ser correcto. - Ashwin
Ponga un espacio entre cada parámetro - andy256
De acuerdo, lo intenté ahora, estos son los errores que se arrojan ahora. Estos son los mismos que cuando no se pasa la ruta a Kernel32.lib:
Error: Unresolved external 'VirtualAlloc' referenced from module filename.asm
Error: Unresolved external 'GetProcAddress' referenced from module filename.asm
Error: Unresolved external 'GetModuleHandleA' referenced from module filename.asm
Error: Unresolved external 'VirtualFree' referenced from module filename.asm
Error: Unresolved external 'ExitProcess' referenced from module filename.asm
- Ashwin