This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

Uncalled segment due to external variable?

I know you have many discussions about warning L16 but I couldn't find one that would match with my problem below.

I got a warning L16: uncalled segment - SEGMENT: ?PR?API_module2?MODULE2 which my app had nothing to do with. See code below:

in test.c:  ---> app code built with lib1.lib
main {
 api_module1();
}

in module1.c: ----> part of lib1.lib
volatile char var1
api_module1( void ) {
   var1 = ...
}

in module2.c: ----> part of lib1.lib
extern volatile char var1
api_module2 ( void ) {
 if (var1 == ...)
}

I suspect the reason I got this warning was because of the global variable var1 (can't find any other link between these two modules except for this global variable).

Question:
If this variable is actually causing this problem, how do I get rid of it as it is increasing my app's code size unnecessary (by also include module2).
If this variable could not possible be causing this warning, where else should I look?

Also, in module2.c I have another API which does NOT use this var1 global variable but I also got the same warning. Any idea?

Parents
  • Sorry for being unclear. What I meant is my app linked to a library called lib1.lib. Lib1.lib was built with two .c files called module1.c and module2.c. My app only used the function defined in module1.c and nothing in module2.c. There is one variable I found that is used between these two c files. The warnings were for the functions defined in module2.c which my app does not call.

    I can't simply get rid of this variable because my other apps used module1 and module2 extensively.

Reply
  • Sorry for being unclear. What I meant is my app linked to a library called lib1.lib. Lib1.lib was built with two .c files called module1.c and module2.c. My app only used the function defined in module1.c and nothing in module2.c. There is one variable I found that is used between these two c files. The warnings were for the functions defined in module2.c which my app does not call.

    I can't simply get rid of this variable because my other apps used module1 and module2 extensively.

Children
No data