delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/2000/01/03/13:07:06

From: Nate Eldredge <neldredge AT hmc DOT edu>
Newsgroups: comp.os.msdos.djgpp
Subject: Re: inline functions -- unknown references
Date: 03 Jan 2000 00:57:07 -0800
Organization: InterWorld Communications
Lines: 39
Message-ID: <83ogb38rdo.fsf@mercury.st.hmc.edu>
References: <fyoofqnexgrpubet DOT fnl1720 DOT pminews AT nntp DOT generation DOT net>
NNTP-Posting-Host: mercury.st.hmc.edu
X-Trace: nntp1.interworld.net 946889832 54709 134.173.45.219 (3 Jan 2000 08:57:12 GMT)
X-Complaints-To: usenet AT nntp1 DOT interworld DOT net
NNTP-Posting-Date: 3 Jan 2000 08:57:12 GMT
X-Newsreader: Gnus v5.7/Emacs 20.4
To: djgpp AT delorie DOT com
DJ-Gateway: from newsgroup comp.os.msdos.djgpp
Reply-To: djgpp AT delorie DOT com

"sl" <junk AT bbs DOT darktech DOT org> writes:

> Hi,
> 
> 	I'd like to make some of my functions 'inline'.. As far as I know,
> placing the word 'inline' right before the function implementation should be
> enough.. Unfortunately when I do this and I call these functions from other
> source-files, I get "unknown reference" errors.. I was told this had to do
> with the fact that I am calling inline functions in one source-file from
> ANOTHER source-file.. Supposidly that's illegal..
> 
> 	Could someone please explain this to me? I would like to inline my
> GFX library functions (such as plot()ing a pixel) but be able to use them
> from other files.. This seems reasonable enough no? :)

Hello,

Can you post a complete example which demonstrates this problem?
AFAIK, you should be able to declare functions inline without changing
their availability from other source files (except in a few special
cases).  

Please also include:
* The compiler version you are using.
* Whether this is C or C++
* The command line you use to compile, and the exact error message you
get.

Be aware that if you have an inline function `foo', only references to
`foo' in the same file where it is defined (or one included from
there) will actually be compiled inline.  Calls from other files will
be compiled as if inline were not there at all.  This is a consequence
of the fact that the compiler itself deals with only one file at a
time.

-- 

Nate Eldredge
neldredge AT hmc DOT edu

- Raw text -


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