Hello! There's a problem with static linking (and no problems with dynamic linking). Here's my code:
Quote:
#include "CBuzzer.h"
int main()
{
BuzzerInit();
return 0;
}
|
And makefile rule:
Quote:
$(OUTDIR)/plainc_test: plainc_test.c
@echo "Plain C API test: $@"
@nm -a $(LIB_ROOT)/obj/$(ARCH)/$(CFG)/libtfccore.a | grep BuzzerInit
$(CC) -o $@ $(INCLUDES) $(PLAIN_CCFLAGS) -L$(LIB_ROOT)/obj/$(ARCH)/$(CFG) -ltfccore $<
|
That's dynamic linking. And it works perfectly. If i use static linking
Quote:
$(CC) -o $@ $(INCLUDES) $(PLAIN_CCFLAGS) -L$(LIB_ROOT)/obj/$(ARCH)/$(CFG) -static -ltfccore $<
|
there is an undefined reference error:
Quote:
Plain C API test: obj/target/plainc_test
00000b88 T BuzzerInit
/tmp/ccxZih7c.o: In function `main':
/home/aparamonov/svn/tfccore/trunk/tests/plainc_test.c:44: undefined reference to `BuzzerInit'
collect2: ld returned 1 exit status
make: *** [obj/target/plainc_test] Error 1
|
As nm shows there's a symbol named BuzzerInit in static library. Does anybody know what's wrong with it?