DSPRelated.com
Forums

how to let compiler to inline functions between multiple files?

Started by zhoux1977 July 20, 2006
i want to config some functions to be inlined.

So i manually add "inline" key word at the position of function
declartion and function defination. while, the linker give the below
errors alike:

" *** function referenced, but not defined"
while, i found that this error is caused by the fact that calling
position and defination position of that function are not in the same
source file.

while, I don't want to change the function's defination position, so,
is there any method to resolve this problem?

Regards,
ZhouXiao
>>From: c... [mailto:c...] On Behalf Of
zhoux1977
>>Sent: Thursday, July 20, 2006 2:10 AM
>>To: c...
>>Subject: [c6x] how to let compiler to inline functions between multiple
files?
>>i want to config some functions to be inlined.
>>
>>So i manually add "inline" key word at the position of function
>>declartion and function defination. while, the linker give the below
>>errors alike:
>>
>>" *** function referenced, but not defined"
>>
>>while, i found that this error is caused by the fact that calling
>>position and defination position of that function are not in the same
>>source file.
>>
>>while, I don't want to change the function's defination position, so,
>>is there any method to resolve this problem?

Most likely you need to move the inline function to a header file. Most
compiler I have used require this, maybe all do.

If you think about this it makes sense. When a function is inlined the
compiler takes function code and, instead of calling an address, sticks the
code right in line. In order to do this the compiler needs the code. Suppose
the code is in inline.c. If the compiler is compiling the function
my_spiffy_filter.c, how will the compiler find the function? Now if the
function is in inline.h and is included my_spiffy_filter.c, then the
compiler can find it ...