Mail Archives: djgpp/2000/01/03/13:07:06
"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 -