DSPRelated.com
Forums

Did you ever work with minit()?

Started by ahma...@yahoo.com April 3, 2008
hi
When I used minit() function in my code the following error message appeared at link time:
error: absolute symbol _malloc in C:\CCStudio_v3.1\C5400\cgtools\lib\rts_EXT.lib is defined multiple times

this error repeated 2 times more for _calloc,_realloc,
Would you know why?
Regards
Ahmad-

> When I used minit() function in my code the following error message
> appeared at link time:
> error: absolute symbol _malloc in C:\CCStudio_v3.1\C5400\cgtools\lib\rts_EXT.lib is defined multiple times
>
> this error repeated 2 times more for _calloc,_realloc,
> Would you know why?

My guess is that rts_ext.lib is listed in the project more than once. You might
check the DSP/BIOS .cmd file, user-defined .cmd file, and 'Libraries' field in the
project Build Options (under Linker tab) to see if there is any duplication.

-Jeff
> Subject: Re: Did you ever work with minit()?
> Posted by: "Jeff Brower" j...@signalogic.com
> Date: Fri Apr 4, 2008 10:27 am ((PDT))
>
> Ahmad-
>
> > When I used minit() function in my code the following error message
> > appeared at link time:
> > error: absolute symbol _malloc in
> > C:\CCStudio_v3.1\C5400\cgtools\lib\rts_EXT.lib is defined multiple times
> >
> > this error repeated 2 times more for _calloc,_realloc,
> > Would you know why?
>
> My guess is that rts_ext.lib is listed in the project more than once. You might
> check the DSP/BIOS .cmd file, user-defined .cmd file, and 'Libraries' field in the
> project Build Options (under Linker tab) to see if there is any duplication.

A function in a library is linked in just one time, either from the last
library with that external symbol from the list of the libraries, or if
-priority option was specified, this external symbol is linked in from the
first library that contains it.

Multiple definition occurs when the same symbol is defined in multiple object
modules that all specified to be linked in into the same executable.

Apparently, there are corresponding definitions of RTS's memory handling
functions in the application's .obj's files.

There's a companion question to which I do not know an answer as yet: what
would happen if a file scope global _variable_ was defined in several files
and these files are archived each into a separate library and these libraries
are in the list of the libraries to be searched by the linker to link an
application. For example:

src1.c contains global int var1
src2.c contains global int var1
etc.,
src1.obj is archived into lib1.lib
src2.obj is archived into lib1.lib
etc.,
and the linker is invoked with an option -l lib1 -l lib2 etc..

Will try to experiment with this.

Rgds,

Andrew