www.delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/2001/01/05/11:51:43

From: pixelpajas AT my-deja DOT com
Newsgroups: comp.os.msdos.djgpp
Subject: Nasm & Gcc. HELP!
Date: Fri, 05 Jan 2001 16:40:17 GMT
Organization: Deja.com
Lines: 71
Message-ID: <934tdg$oj0$1@nnrp1.deja.com>
NNTP-Posting-Host: 194.236.50.233
X-Article-Creation-Date: Fri Jan 05 16:11:48 2001 GMT
X-Http-User-Agent: Mozilla/4.0 (compatible; MSIE 5.0; Windows 98; DigExt)
X-Http-Proxy: 1.1 x61.deja.com:80 (Squid/1.1.22) for client 194.236.50.233
To: djgpp AT delorie DOT com
DJ-Gateway: from newsgroup comp.os.msdos.djgpp
Reply-To: djgpp AT delorie DOT com


Hi .. I'm trying to learn how to use nasm
assembler code with gcc but i get an error when i
link the objects. Below are the source files and
command compile/link entries.



- 4k.c ----------------------------------------

extern unsigned int keyget(unsigned int);

void main(void)
{
	keyget(1);
}

-----------------------------------------------


- lib.asm -------------------------------------

[BITS 32]
[GLOBAL _key]
[SECTION .text]


_key:         MOV       CX,1

keyloop:      MOV       AH,01h
              INT       16h

              JZ        keyloop
              MOV       AH,00h
              INT       16h

              MOV       AH,0Ah
              INT       10h

              CMP       AL,0Dh
              JNE       keyloop

              MOV       AH,4Ch // clean exit
              INT       21h    // ----------

-----------------------------------------------

first i build lib.asm -> nasm -f coff lib.asm

then i compile 4k.c -> gxx -nostdlib -nostdinc -
fno-builtin -fno-exceptions -c -O3 4k.c -r

and at last i try to link -> ld -nostdlib -
nostdinc -fno-builtin -fno-exceptions -e _main -
oformat binary -o 4k.com 4k.o lib.o

but in the last step i get -> " 4k.o
(.text+0x6):4k.c: undefined reference to `_keyget
(unsigned int)' "


Is there anyone out there that can help me and
tell me what im doing wrong???

regards
/iman


Sent via Deja.com
http://www.deja.com/

- Raw text -


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