delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/2002/01/31/22:17:11

X-Authentication-Warning: delorie.com: mailnull set sender to djgpp-bounces using -f
From: "Joel Saunders" <jbs30000 AT aol DOT com>
Newsgroups: comp.os.msdos.djgpp
Subject: Compiling and linking ASM and C++ files.
Date: Fri, 1 Feb 2002 03:03:41 +0000 (UTC)
Organization: Mailgate.ORG Server - http://www.Mailgate.ORG
Lines: 52
Message-ID: <74ee5cc121b560fecbc3a4278528749b.62691@mygate.mailgate.org>
NNTP-Posting-Host: spider-tk081.proxy.aol.com
X-Trace: news.mailgate.org 1012519141 9036 152.163.206.211 (Fri Feb 1 04:03:41 2002)
X-Complaints-To: abuse AT mailgate DOT org
NNTP-Posting-Date: Fri, 1 Feb 2002 03:03:41 +0000 (UTC)
Injector-Info: news.mailgate.org; posting-host=spider-tk081.proxy.aol.com; posting-account=62691; posting-date=1012519141
User-Agent: Mailgate Web Server
X-URL: http://mygate.mailgate.org/mynews/comp/comp.os.msdos.djgpp/74ee5cc121b560fecbc3a4278528749b.62691%40mygate.mailgate.org
To: djgpp AT delorie DOT com
DJ-Gateway: from newsgroup comp.os.msdos.djgpp
Reply-To: djgpp AT delorie DOT com

I've made projects before where I've successfully compiled and linked
togeather multiple C++ files.  So I decided to try to do the same with
one C++ file and an ASM file.  I was searching for examples of ASM files
that used .intel_syntax and pretty much found only one.  So I used that
example for my ASM file (.s file) and then made a C++ file that called
the routine in the .s file.  The routine in the .s file doesn't work,
but that's not important.  All I want to know, is why I get the errors
I'm getting when Rhide goes to link the files togeather.  First I'll
show .s file, then the .cpp file, and then the error.  Thanks in advance
for your help.
global _start 
.intel_syntax noprefix 

.section .text 
_start: 

mov eax, 4 
mov ebx, 1 
mov ecx, offset msg 
mov edx, msg_len 
int 0x80; 

xor eax, eax 
inc eax 
int 0x80 

.section .data 
msg: .ascii "Hello, from gas " 
msg_len = .-msg 

Now, the C++ Part: 
extern void start(); 
main(void) 
{ 
start(); 
return 0; 
} 

Now the errors: 

-[_]--------------------------- Message Window
-------------------------4-[]-
Creating: asm.exe 
Error: casmtest.o: In function `main': 
casmtest.cpp(4) Error: undefined reference to `start()' 
Error: casmtest.o(.eh_frame+0x11):casmtest.cpp: undefined reference to
`__gxx_personality_v0'
There were some errors 


-- 
Posted via Mailgate.ORG Server - http://www.Mailgate.ORG

- Raw text -


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