V
Varun Tewari
People,
I came across this scenario today on vxworks, using arm tool chain
ccarm for compiling
ararm for archiving
ldarm for linking.
I have compiled two sets of files a*.c and b*.c using ccarm.
Now, using ararm I create two libraries A.a and B.a
Then I am writing a small program(varun.c), which invokes api's in B.a
again this is compiled using ccarm and goes through.
Now, i start to link using ldarm
ldarm -lA -lB varun.o -o varun
Here, I start getting error(undefined reference) for all api's of A which api's in B invoke.
Now, when I invoke, explicitly in my code (varun.c) for which intially i was getting undefined reference, things work fine.
After doing some hit and trail, I realized, in essence the thing is, until I do some explicit invocation of atleast one api of file a1.c, none of the api's of a1.c archived in A.a are getting linked.
I know this probably isn't the precise place to ask this, and please ignore the ccarm, ldarm and ararm tools.
The reason I am posting this here, is that I found this pretty interesting and weird, and wanted to know if we turn on some option in C or gcc by default that makes us not hit this issue on linux.
I understand there is some operating system dependency here for this behavior, and its possible that one a flavor of linux, we might see such behavior and on other we might not, still what causes such behavior on a typical OS.
Is something like that specified by C.
2. does gcc has any such functionality that even after linking, you get error until we explicitly invoke.
Please excuse me, if you still think its unreasonable to post this here.
Pour in.
I came across this scenario today on vxworks, using arm tool chain
ccarm for compiling
ararm for archiving
ldarm for linking.
I have compiled two sets of files a*.c and b*.c using ccarm.
Now, using ararm I create two libraries A.a and B.a
Then I am writing a small program(varun.c), which invokes api's in B.a
again this is compiled using ccarm and goes through.
Now, i start to link using ldarm
ldarm -lA -lB varun.o -o varun
Here, I start getting error(undefined reference) for all api's of A which api's in B invoke.
Now, when I invoke, explicitly in my code (varun.c) for which intially i was getting undefined reference, things work fine.
After doing some hit and trail, I realized, in essence the thing is, until I do some explicit invocation of atleast one api of file a1.c, none of the api's of a1.c archived in A.a are getting linked.
I know this probably isn't the precise place to ask this, and please ignore the ccarm, ldarm and ararm tools.
The reason I am posting this here, is that I found this pretty interesting and weird, and wanted to know if we turn on some option in C or gcc by default that makes us not hit this issue on linux.
I understand there is some operating system dependency here for this behavior, and its possible that one a flavor of linux, we might see such behavior and on other we might not, still what causes such behavior on a typical OS.
Is something like that specified by C.
2. does gcc has any such functionality that even after linking, you get error until we explicitly invoke.
Please excuse me, if you still think its unreasonable to post this here.
Pour in.