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.

Symbol Preemption

Hi All,

I'm trying to create a simulation test harness that stubs out interface functionality, so that I can automate and view my results.  So, I have a production static library I'll call Production.lib, and I have a stubs static library, called Stubs.lib.  I create a unit test harness that links in both Production.lib and Stubs.lib.  Production.lib contains a .obj file, I'll call Interface.obj, that I would like to stub out with the same implementation in Stubs.lib.  However, at link time, I get a bunch of "symbol redefined" link error #10056.  I found a way to do symbol preemption using dll's, but I like using static libraries.  Is there any way to achieve this?

Thanks,
Bill

  • Bill,

    If I understood correctly, you have defined symbols in some libraries and is trying to override them with other libraries, right? If so, I experimented a bit here but couldn't override a symbol between two libraries, only between a library and a source file (the link order defines which one is used). Unless I am missing something, I don't think it is possible to do that using static libraries.

    I will get back to this thread if I find a way to do this, ok?

    Regards,

    Rafael

  • It is possible to structure the link such that functions in stubs.lib are used instead of functions of the same name in production.lib.  Make sure that the last two input files the linker sees are, in this order: stubs.lib production.lib.  That will probably solve the problem, though I can't make any guarantees.  If it doesn't work, then I need to know more details about the link.  Show me exactly how the linker is invoked, and the exact text of the full error message(s).

    Thanks and regards,

    -George

  • Rafael,

    That's exactly what I'm trying to do.  Thanks for your reply, and let me know if you find a way to do this.

    Thanks,
    Bill 

  • Hi George,

    Thanks for your answer.  I will try it out and let you know what I find.

    Thanks,
    Bill 

  • Hi CCS champions,

    I have the same problem that is shown as below:

    error #10056: symbol "putchar" redefined: first defined in
       Recommend initializing all unused ports to eliminate wasted current
       "./firmware/hal_usb.obj"; redefined in
       consumption on unused pins.
       "C:\ti\ccsv5\tools\compiler\msp430_4.1.0\lib\rts430x_lc_sd_eabi.lib<fputc.ob
       j>"

    I guess the situation is a symbol redefined between a library and a source file that you mentioned, so how can I resolve the issue?

    Thank you very much! 

     

  • I cannot explain what is happening.  But I can reproduce it.  So, I filed SDSCM00044286 in the SDOWP system.  Feel free to follow it with the SDOWP link below in my signature.

    Side note ...This is one of those very rare cases where I can reproduce the error without first asking for a test case.  I can't recall the last time this happened.

    Thanks and regards,

    -George

  • This error is valid and not a bug.   What's going on is putchar() is redefined in user code, but then the user's code also uses other library functions that bring in the library's definition of putchar().  The proper solution to creating new device drivers for CIO is discussed in this entry: http://e2e.ti.com/support/development_tools/compiler/f/343/t/194851.aspx