DSPRelated.com
Forums

asm function showing linker error

Started by Jagadeesh Bhaskar P November 10, 2005

Hi,

            I am having a funtion, say foo, defined in asm (as _foo). I used this function in building a library (let me call this x.lib). This was not having any error. I inturn used this x.lib file in building another project (say y.out). While building y.out, i am getting a linker error, telling an undefined symbol, _foo in x.lib. Also in the files associated with y.out, there is no reference to foo and all the calls to foo is just in C files associated with x.lib.

I am not sure what causes this error.

 

Please do help.

 

TIA.

--

jag.

 



Pls. check if your library has correctly been included. If the error is due to some standard functions, check if you have included RTS libraries etc.. Also, verify that when you are calling the function, the definition and preferably declaration are available. Its either the library isn't included or the linker is unable to locate the definition of the function which means you haven't included your source properly.

Hope this helps.
Ganesh
----- Original Message -----
From: Jagadeesh Bhaskar P
To: c6x@c6x@...
Sent: Thursday, November 10, 2005 11:26 AM
Subject: [c6x] asm function showing linker error Hi,

I am having a funtion, say foo, defined in asm (as _foo). I used this function in building a library (let me call this x.lib). This was not having any error. I inturn used this x.lib file in building another project (say y.out). While building y.out, i am getting a linker error, telling an undefined symbol, _foo in x.lib. Also in the files associated with y.out, there is no reference to foo and all the calls to foo is just in C files associated with x.lib.

I am not sure what causes this error.
Please do help.
TIA.

--

jag.


Hi,
Thank you for the reply. It was not a standard function, but just one
written by me itself. Now i tried clubbing up files in the library and
the application, yet again im getting the error. I have the function's
definition, ie the asm file, added to the project. Also before the usage
I have the function itself defined. Actually the function is getting
assigned to a function pointer and that container funcion is the one
getting called. But still it is giving linker error on the function.

Why could this be? Do help.

TIA.

--
jag.


Can you try without function pointer ? If your function is defined properly and is added in your library project, then it should get linked. Somewhere you are missing something. I guess you need to cross-verify if your source i.e. asm file is indeed included and compiled.
Ganesh
----- Original Message -----
From: Jagadeesh Bhaskar P
To: 'Ganesh Vijayan'
Cc: c6x@c6x@...
Sent: Thursday, November 10, 2005 12:41 PM
Subject: Re: [c6x] asm function showing linker error Hi,

Thank you for the reply. It was not a standard function, but just one written by me itself. Now i tried clubbing up files in the library and the application, yet again im getting the error. I have the function's definition, ie the asm file, added to the project. Also before the usage I have the function itself defined. Actually the function is getting assigned to a function pointer and that container funcion is the one getting called. But still it is giving linker error on the function.
Why could this be? Do help.
TIA.
--

jag.


You need to say .global _foo, so that foo gets an entry in the symbol table.
I would do most of my work in C, followed

by linear assembly and never using manual assembly, as the chances of errors
go up. Just my feedback.
Regds

JS
_____

From: c6x@c6x@... [mailto:c6x@c6x@...] On Behalf Of
Jagadeesh Bhaskar P
Sent: Wednesday, November 09, 2005 11:56 PM
To: c6x@c6x@...
Subject: [c6x] asm function showing linker error
Hi,

I am having a funtion, say foo, defined in asm (as _foo). I used
this function in building a library (let me call this x.lib). This was not
having any error. I inturn used this x.lib file in building another project
(say y.out). While building y.out, i am getting a linker error, telling an
undefined symbol, _foo in x.lib. Also in the files associated with y.out,
there is no reference to foo and all the calls to foo is just in C files
associated with x.lib.

I am not sure what causes this error.
Please do help.
TIA.

--

jag.


Hi,
Im sorry to say that the issue was the ASM function getting called
from a "CPP" file. So the function's declaration needed an extra: extern
"C", which I was unaware of. Thanks for all the replies.

--
jag
"Quaerendo invenietis"

-----Original Message-----
From: Ganesh Vijayan [mailto:ganesh@gane...]
Sent: Thursday, November 10, 2005 1:26 PM
To: Jagadeesh Bhaskar P
Cc: c6x@c6x@...
Subject: Re: [c6x] asm function showing linker error

Can you try without function pointer ? If your function is defined
properly and is added in your library project, then it should get
linked. Somewhere you are missing something. I guess you need to
cross-verify if your source i.e. asm file is indeed included and
compiled.
Ganesh
----- Original Message -----
From: Jagadeesh <mailto:jagadeeshbp@jaga...> Bhaskar P
To: 'Ganesh Vijayan' <mailto:ganesh@gane...>
Cc: c6x@c6x@...
Sent: Thursday, November 10, 2005 12:41 PM
Subject: Re: [c6x] asm function showing linker error

Hi,
Thank you for the reply. It was not a standard function, but just one
written by me itself. Now i tried clubbing up files in the library and
the application, yet again im getting the error. I have the function's
definition, ie the asm file, added to the project. Also before the usage
I have the function itself defined. Actually the function is getting
assigned to a function pointer and that container funcion is the one
getting called. But still it is giving linker error on the function.

Why could this be? Do help.

TIA.

--
jag.