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.

CCS: How can I build a static lib which include two lib in CCSV7?

Tool/software: Code Composer Studio

Hi everyone:

I want to bulid a static library my.lib which include my code. And my code called  some function from a.lib and b.lib. Is there anyway to bulid my.lib whick include my code and a.lib, b.lib? When I need to call my code in other project, I just neet to link my.lib.

my tool is Code Composer Studio 7.2.0.

thanks!

Seven

  • It is not possible to create a hierarchy of libraries, similar to how you can create hierarchy of directories.  Even so, that does not cause any problems.  I presume my.lib contains functions which call other functions in a.lib and b.lib.  So, organize those functions into my.lib.  Your top level project can refer to my.lib, a.lib, and b.lib.  The linker knows how to get the needed functions from each of those libraries.

    Thanks and regards,

    -George

  • Hi George.

    Thank you for your reply. I understand what you mean. Moreover, I want to know, could I find a way to build another lib which include my.lib, a.lib, b.lib? My top project linker only need to refer this lib.

    Thanks!

    Seven

  • Hi,
    I'm not sure it works, but you could try to extract the file from a.lib and b.lib and add them to my.lib.
    For instance, for C6000 you can "ar6x -x ..." to extract and then "ar6x-a ..." to add to my.lib
  • Mr Seven said:
    could I find a way to build another lib which include my.lib, a.lib, b.lib?

    You don't say which CPU family you use.  For now, I presume it is an ARM device.  I use ARM toolset commands in the example below.

    Run commands similar to these in an empty directory.

    % armar -x /path1/to/mylib.lib
    % armar -x /path2/to/a.lib
    % armar -x /path3/to/b.lib
    % armar -r top_level.lib *.obj

    The first three commands extract the contents of those libraries into the current directory.  The last command creates a new library named top_level.lib which contains all of those object files.

    The archiver is documented in the Assembly Language Tools manual for your toolset.  This page has links to all of those manuals.

    Thanks and regards,

    -George