Mail Archives: djgpp/1999/12/30/23:13:17
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 -