This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
Re: multiple defintions error
On Mon, Sep 25, 2000 at 07:11:20PM +0800, Atif Shahab wrote:
>
> That worked. And I can see why since by defining static we're linking to
> the locally included copy of the functions. However, just out of
> curosity, is there another way too. Or should I use this technique
This is the right way. When 'static' is defined as function attribute, that
function is threaten as local for that module. So linker assumes, that they
are different, although the local copies of functions are compiled from the
same source.
> whenever I encounter this problem. Also, the program I'm writing has to
> run real time so any performance penalty by doing this?
It is like you copy&paste such function into each source file, so no
performance penalities occurs. It is IMHO the only way how to share
functions which has to be inlined.
Jan Dvorak <johnydog@go.cz>