Calling a function in Library(.LIB) file


#1

hi ,
i have created a library project, it has SMS.c( contains SMSSubscribe() ) ,TCP.c( TCPClientCreate() ), SIM.c( contains SIMSubscribe() ) files. Then i have inlcuded .LIB file in my application pgm.
when am calling those functions from my application program am getting error.
make.exe: *** [make_single_bin] Error 1
Done. In Target mode

while building in RTE mode, its saying undefined reference to SMSSubscribe(), TCPClientCreate(), SIMSubscribe().
but i have written all the prototypes,

thank you…

Aghil


#2

How did you do that?

Prototypes simply inform the compiler of how to call them - the linker needs the actual code to link!


#3

after building the library project, in target mode, we get a .LIB file in …/gcc/out/ folder…right?
i created a folder named lib in my binary project and copied .LIB file into it. ok ?
then included it in my binary project, by writing the below mentioned script in wmnew additional script options window.
-extlib E:/myAppl/lib -libname gcc_myLib.LIB

when am calling those functions from my application program am getting
error.
make.exe: *** [make_single_bin] Error 1
Done.
(while building In Target mode)


#4

viewtopic.php?f=19&t=2191&p=8094&hilit=custom+library#p8094

viewtopic.php?f=47&t=1841&p=6705&hilit=custom+library#p6705


#5

the library works fine when there is only a single interface to it.

but consider the case where u have many *.c files in ur library project, where each file has some different functions like gprsinit(), siminit(),etc …ok
when u call each of these functions in ur application pgm, it gives build error , as i said earlier…
i would like to know can we have more than one interface to the library…

thanks you…
Aghil


#6

Exactly what error(s) does it give - all of them?


#7

it gives “undefined reference to function”.
inspite of including their prototypes…


#8

There you go again!

As I said before, just including prototypes is not sufficient!


#9

so wat am i supposed to do??