Tip / Sign in to post questions, reply, level up, and achieve exciting badges. Know more

cross mob
13_4788251
Level 2
Level 2
10 questions asked 5 replies posted 5 questions asked

Now there are two static libraries: [lib1.a] [lib2.a]

lib1.a

    int testfun(void)
    {
        return 1;
    }

lib2.a

    int testfun(void)
    {
        return 2;
    }

main.h

    extern int testfun(void);

main.c

    #include "main.h"

    int main(void)
    {
         volatile int a;
        a = testfun();

        return 0;
    }

 

How to determine the value of [a] in the above code?

In other words, how to compile the specified static library in ModusToolbox.

0 Likes
1 Solution
raks_99
Moderator
Moderator
Moderator
First question asked 250 replies posted 250 sign-ins

Hi,

The example that you provided should throw a linker error since you have two functions having the same names in two different files. 

In the document https://www.cypress.com/file/520251/download

Page 36, section 4.5.1.5, There is an explanation on how you can include two different source files in a different component folder and then you can configure your makefile to use the one you require.

Best Regards,

Rakshith

View solution in original post

1 Reply
raks_99
Moderator
Moderator
Moderator
First question asked 250 replies posted 250 sign-ins

Hi,

The example that you provided should throw a linker error since you have two functions having the same names in two different files. 

In the document https://www.cypress.com/file/520251/download

Page 36, section 4.5.1.5, There is an explanation on how you can include two different source files in a different component folder and then you can configure your makefile to use the one you require.

Best Regards,

Rakshith