delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1998/02/04/23:46:29

From: mattrud AT aol DOT com (MATTRUD)
Newsgroups: comp.os.msdos.djgpp
Subject: Multiple object files
Date: 5 Feb 1998 04:38:32 GMT
Lines: 35
Message-ID: <19980205043801.XAA06728@ladder03.news.aol.com>
NNTP-Posting-Host: ladder03.news.aol.com
Organization: AOL http://www.aol.com
To: djgpp AT delorie DOT com
DJ-Gateway: from newsgroup comp.os.msdos.djgpp

I have these two source files:

*;return0.asm, compiled with NASM
*;command line: nasm -fcoff return0.asm
*;
*global _return0
*_return0:      xor dx, dx
*                xor eax, eax
*                ret

and

*//ret0.cpp, compiled with GCC and linked to return0.o
*//command line:  gcc ret0.cpp return0.o -lgpp
*//
*//#include<iostream.h>
*//int main()
*{
*        
*
*        int i = extern return0();
*
*        cout<<endl<<endl<<"The number is "<<i<<endl<<endl;
*
*        return 0;
*
*}

The gcc call returns with 
*ret0.cc:undefined reference to 'return0(void)'

So my question is, how do I call a function from a different source file, in
this case, return0()?

Ruds

- Raw text -


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