www.delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1998/02/06/01:25:48

Date: Thu, 5 Feb 1998 20:55:04 -0800 (PST)
Message-Id: <199802060455.UAA04116@adit.ap.net>
Mime-Version: 1.0
To: mattrud AT aol DOT com (MATTRUD), djgpp AT delorie DOT com
From: Nate Eldredge <eldredge AT ap DOT net>
Subject: Re: Multiple object files

At 04:38  2/5/1998 GMT, MATTRUD wrote:
>I have these two source files:
[snipped]
>So my question is, how do I call a function from a different source file, in
>this case, return0()?
First off, your syntax:
int i = extern return0();
is very bizzare and I'm not even sure if it's legal.

Your major problem here is that the compiler mangles names in a C++ file,
which causes unmangled names not to match. You need to do something like this:

extern "C" int return0(void);

/* ... */

        i = return0();

Hope this helps.

Nate Eldredge
eldredge AT ap DOT net



- Raw text -


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