This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

Math library in combination with C++ on the 28335

Hi,

I am testing if development with c++ is possible without to much drawbacks.

Now i have an issue i don't know how to fix. I hope someone can help me.

When I include <math.h> in an cpp file, the code size increases dramasticly compared to including it in a c file.

Can someone tell me why this is and how to solve this issue.

I do not need the object oriented library just c will do.

Thanks in advance

With regards,

 

Alex

 

 

 

  • Hi Alex

    I'd check .map file for functions that are included from rts2800_ml.lib, but I suspect that exception handling is the culprit (if you are using rts2800_ml_eh.lib)

    Regards, Mitja

  • Hi,

    Thanks for your reply.

    I use rts2800_fpu32.lib and rts2800_fpu32_fast_supplement.lib.

    This is a part of the map file that is extra needed when compiling for c++ instead of c:

                      00009a8a    000001f3     rts2800_fpu32.lib : memory.obj (.text)

                      0000aa75    00000027     rts2800_fpu32.lib : sinit.obj (.text)

                      0000aa9c    00000026                       : atexit.obj (.text)

                      0000aac2    00000022                       : new_.obj (.text)

                      0000aae4    00000021                       : memcpy_ff.obj (.text)

                      0000ab85    00000006                       : delete.obj (.text)

                      0000ab8b    00000004                       : pure_virt.obj (.text)

                      0000ab8f    00000003                       : error.obj (.text)

                      0000ab92    00000001                       : newhandler.obj (.text)

    Anyone any idea how to prevent these functions? I do not need a object oriented library, it could just be compiled as "c" code.

    With regards,

    Alex

     

  • Alex,

    I am going to move this to the compiler forum so the experts there can take a look.   What does the Cpp code look like?

    -Lori

  • See the following forum thread: http://e2e.ti.com/support/development_tools/compiler/f/343/p/55673/200501.aspx

    Probably math.h is not to blame; there's probably an object in the project which gets allocated with new somewhere, possibly guarded by "#ifdef __cplusplus".  It's hard to tell from just the map file what is causing these functions to be dragged in.

  • I think your right. math.h is not to blame. I do not include any library header files at the moment and i still get the above functions.

    I do not use 'new' but i can imagine that some library funtions do that. 

    I do not care about the small functions, there is one larger object which is the memory object. 

    Can anyone tell me what that one does? I can imagine something but if someone has more detail, it is always nice to know ;-).

    With regards,

     

    Alex

     

  • "memory.obj" is the code for free/malloc/calloc/realloc.  If you call any of these functions, or new/delete, or any library function which calls one of those, you're going to get memory.obj in your executable.