new() error

Chris Johns cjohns at cybertec.com.au
Wed Aug 27 01:32:31 UTC 2003


Francesco Poletti wrote:
> 
> The main questions is: does someone know how the new() functions is linked to
> RTEMS and in particoularly with the rtems_region_allocator or the heap?
> 

The new allocator is in the stdc++. Look for the file in GCC source:

   gcc/gcc/libstdc++-v3/libsupc++/new_op.cc

for an example of new. It uses malloc to get the memory and malloc is part of the 
libcsupport section of RTEMS.

The code as a link can be view online here:

http://savannah.gnu.org/cgi-bin/viewcvs/gcc/gcc/libstdc%2B%2B-v3/libsupc%2B%2B/new_op.cc?rev=1.6&content-type=text/vnd.viewcvs-markup

> I have also try to see where may have been defined the "new()"  functions but I
> don't found it.

It is in libstdc++.a. For a Coldfire I can do:

  $ m68k-rtems-nm --demangle `m68k-rtems-gcc -print-file-name=libstdc++.a` | grep new

and get a list of the various new operators in the library.

> Need I to manually add this functions and to link it with one allocator?

Standard allocators are provided in stdc++ and using g++ to link will automatically 
link in stdc++.

-- 
  Chris Johns, cjohns at cybertec . com . au




More information about the users mailing list