HELP: assembly & C linking woes....

This is a discussion on HELP: assembly & C linking woes.... within the Tech Board forums, part of the Community Boards category; I am having problems linking an assembly object with my C object files. Am getting: Linker Warning: DOSSEG directive ignored ...

  1. #1
    Registered User
    Join Date
    Jun 2007
    Posts
    9

    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?

  2. #2
    Registered User
    Join Date
    Jun 2007
    Posts
    9
    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. #3
    and the hat of wrongness Salem's Avatar
    Join Date
    Aug 2001
    Location
    The edge of the known universe
    Posts
    32,668
    If you dance barefoot on the broken glass of undefined behaviour, you've got to expect the occasional cut.
    If at first you don't succeed, try writing your phone number on the exam paper.
    I support http://www.ukip.org/ as the first necessary step to a free Europe.

  4. #4
    Registered User
    Join Date
    Jun 2007
    Posts
    9
    I read the cool document about Fixup Overflow at http://vmlinux.org/~jakov/community....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?

  5. #5
    Registered User
    Join Date
    Oct 2001
    Posts
    2,934
    >And is that correct corresponding to the C & Pascal types?
    >AsmY label word
    This one should probably be a dword:
    Code:
    AsmY label dword

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. linking to assembly
    By xixpsychoxix in forum C Programming
    Replies: 21
    Last Post: 07-16-2008, 03:51 PM
  2. Linking C++ and Assembly
    By Warlax in forum C++ Programming
    Replies: 6
    Last Post: 10-19-2007, 04:33 PM
  3. True ASM vs. Fake ASM ????
    By DavidP in forum A Brief History of Cprogramming.com
    Replies: 7
    Last Post: 04-02-2003, 03:28 AM
  4. Linking an assembly routine into a GCC project
    By huh in forum C++ Programming
    Replies: 3
    Last Post: 11-21-2002, 02:14 PM
  5. C,C++,Perl,Java
    By brusli in forum C Programming
    Replies: 9
    Last Post: 12-31-2001, 02:35 AM

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21