www.delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/2002/05/15/14:45:41

X-Authentication-Warning: delorie.com: mailnull set sender to djgpp-bounces using -f
X-Info: This message was accepted for relay by
smtp03.mrf.mail.rcn.net as the sender used SMTP authentication
X-Trace: UmFuZG9tSVaYiKOs8BbteI5Gw5o/o8oJ9j/xdWxv0FZJx/oLxVZMhXabHE+MTwehQZI4aDu1xYA=
Message-ID: <3CE2ABFB.BE2CECC0@erols.com>
Date: Wed, 15 May 2002 14:42:03 -0400
From: Chris Smith <herrsmitty AT erols DOT com>
X-Mailer: Mozilla 4.7 [en] (Win98; U)
X-Accept-Language: en
MIME-Version: 1.0
To: djgpp AT delorie DOT com
Subject: DJGPP with ALINK
Reply-To: djgpp AT delorie DOT com

Hello all,
I've been experimenting with ALINK and LD to learn a little more about
how to link C and assembly. However, I can't seem to get figure out why
ALINK gives me an "Unresolved external" warning, yet LD does not. If
anyone has experience using ALINK with DJGPP to call C functions from
assembly, I'd appreciate any possible suggestions.

when I compile as follows:

    nasm -f coff -o starter.o starter.asm
    nasm -f coff -o asm_func.o asm_func.asm
    DJGPP -c c_func.c

then link with ALINK:

    ALINK -entry starter.o asm_func.o c_func.o

I get the following:

    ALINK v1.6 (C) Copyright 1998-9 Anthony A.J. Williams.
    All Rights Reserved
    Loading file asm_func.o
    Loading file c_func.o
    matched Externs
    matched ComDefs
    Unresolved external starter.o

"Unresolved...", did I leave something out? Here's my code for
experimenting with the linker...

;; starter.asm
[bits 32]
[section .text]
extern _c_func
    nop    ; do something
    call    _c_func
    nop    ; do something

/* c_func.c compiled with DJGPP */
void c_func(void)
{
    asm_func();
}

;; asm_func.asm
[bits 32]
[section .text]
global _asm_func
_asm_func:
    nop    ; do something
    ret



- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019