At 4:13 PM +0530 2000/07/31, Nitin FOR Palm wrote:
>I have made a static library (.lib) for Palm using MW Code Warrior.
>
>Now when i add this .lib (which contains implementations of some functions
>of mine) in another project and try to link it , i get a linker error saying
>"function ... undefined" . The project compiles fine though. Can i not use
>the functions from the library straight away ? Or do i need to do something
>else before i can use the functions from the library.
If you're using the C++ compiler, you need to surround your function prototypes with
the following #ifdef header and footer. This stops the compiler's function name
mangling which is causing your function...undefined link errors:
#ifdef __cplusplus
extern "C" {
#endif
void LibraryFunction1(void);
void LibraryFunction2(void);
void LibraryFunction3(void);
#ifdef __cplusplus
}
#endif
All developers who create reusable/shared code with function prototypes should do
this, because you don't know if the receiving developer will be using a C or C++
compiler.
Regards,
Jim Schram
Palm Incorporated
Partner Engineering
--
For information on using the Palm Developer Forums, or to unsubscribe, please see
http://www.palmos.com/dev/tech/support/forums/