HELP: assembly & C linking woes....
I am having problems linking an assembly object with my C object files. Am getting:
Linker Warning: DOSSEG directive ignored in module asm.asm
Linker Error: Undefined symbol _ASMClsV in module main.c
Linker Error: Undefined symbol VADDR in module asm.asm
In my asm.asm file I've got:
DOSSEG
.MODEL huge
.386
.DATA
EXTRN vaddr : word;
.CODE
PUBLIC ASMClsV
ASMClsV PROC Near
;bla bla
ASMClsV EndP
In main.c I've got:
extern void ASMClsV();
Am trying to link using Borland C++ 4.5 since my source files are all 16-bit. I successfully linked the same asm.asm file with a 16-bit pascal object using Turbo Pascal 7.0. Why can't I link using Borland C++ 4.5 to a 16-bit C file?
Also, I used Microsoft Macro Assembler 5. Should I use Turbo Assembler?
# 1 Re: HELP: assembly & C linking woes....
Without really knowing for sure, using Turbo Assembler would probably work better. As far as I remember, back in the days of MS QuickC & Borland Turbo series (16-bit) the obj/lib format used were not compatible.
S_M_A at 2007-11-10 3:55:08 >

# 2 Re: HELP: assembly & C linking woes....
Excellent! I managed to get the C & assembly files recognise each others variables & functions. Thanks to Scorpions4ever for telling me about C mangles variable & function names by prefixing an underscore in front. Now I get a different problem:
Linker Error: Fixup overflow at _TEXT:0002, target = vaddr in module asm.asm
...
It appears there's a linker error line for each of my variables surrounded by [ ], eg.
ASMClsV PROC Near
mov es, [vaddr]
; bla bla
ASMClsV EndP
What does this Fixup overflow mean?
# 3 Re: HELP: assembly & C linking woes....
I read the cool document about Fixup Overflow at http://vmlinux.org/~jakov/community.borland.com/15961.html but still unsuccessful. I fixed this problem myself by moving the variables from the C file to assembly file.
C file:
extern unsigned short vaddr; //Pascal word type
extern long AsmY; //Pascal integer type
extern void *ScrOfsPtr; //Pascal pointer type
Assembly file:
.DATA
PUBLIC vaddr, AsmY, ScrOfsPtr
vaddr label word
AsmY label word
ScrOfsPtr label dword
Now I don't know why I need the label before word/dword. What does that mean? And is that correct corresponding to the C & Pascal types?