www.delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1999/12/30/23:13:17

Message-ID: <386C2157.991E7CDF@caresystems.com.au>
Date: Fri, 31 Dec 1999 13:21:59 +1000
From: leon <Leon AT caresystems DOT com DOT au>
X-Mailer: Mozilla 4.7 [en] (Win95; I)
X-Accept-Language: en
MIME-Version: 1.0
To: djgpp AT delorie DOT com
Subject: Re: inline functions -- unknown references
References: <fyoofqnexgrpubet DOT fnl1720 DOT pminews AT nntp DOT generation DOT net>
Reply-To: djgpp AT delorie DOT com

sl wrote:

> 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? :)
>
> Gili

hey Gili
this is what i know from my limited exp with computing:

mainly - unknown reference in this case would relate to not being able to see
the _source_ code (ie method definition) of the method. Thus in your case i
don't think it is the case of inlining at all.
So if you include headers  - those would include declaration of method - the
definition of those are in cpp - and perhaps your make file or linker do not
find the source for definitions of the methods in the files that you specified
as your source files and lib files.

- just a general thing on inlining - it is only a suggestion to compiler - since
inlining replaces method name with actual code - the compiler must know the
exact instance of class when compiling (ie at static time) - so if you have
something like pointer to method - inlining definitely won'r work.


- Raw text -


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