I am trying to incoporate a third-party device into my PowerPlant app,
however the primary function for accessing the device produces a link
error (using CW8 & CW10.)
The device comes with example code (and gcc makefile) – called DEMO.C --
that works just fine with gcc.
But when I try the example code with CW, I get "Link Error :
undefined: 'KFUNC(unsigned int, unsigned int, unsigned int, unsigned
int)' (code)
Referenced from 'KTASK(unsigned int, unsigned int, unsigned int,
unsigned int)' in DEMO.C"
The undefined "KFUNC" resides in an object file "kfunc32.o" supplied by
the manufacturer; they do not supply the source code. A disassembly of
kfunc32.o shows KFUNC in the long list of names and in the code.
I am supposed to pick and choose the parts of the example that I want to
use. But that is impossible as long as CW thinks KFUNC is undefined.
Why can't CW link properly with KFUNC in the external file kfunc32.o?
Any help is very much appreciated.
Paul Russell - 13 Jan 2006 07:38 GMT
> I am trying to incoporate a third-party device into my PowerPlant app,
> however the primary function for accessing the device produces a link
[quoted text clipped - 18 lines]
>
> Any help is very much appreciated.
My guess is that KFUNC is a C function and you're compiling C++ code
without suitable extern "C" bracketing around your function prototypes
for the fucntions in kfunc32.o.
Paul
Anonymous - 18 Jan 2006 18:41 GMT
>> I am trying to incoporate a third-party device into my PowerPlant app,
>> however the primary function for accessing the device produces a link
[quoted text clipped - 26 lines]
>
> Paul
Would you please give a short example of "suitable extern C bracketing?"
It would save a lot of time (and questions too.)
Thanks for your help
Philippe Casgrain - 18 Jan 2006 21:16 GMT
> Would you please give a short example of "suitable extern C bracketing?"
> It would save a lot of time (and questions too.)
#ifdef __cplusplus
extern "C" {
#endif
void YourFunction();
#ifdef __cplusplus
}
#endif
hth, Philippe

Signature
Replace "replace.this" with "casgrain" to get my email address
larry@skytag.com - 19 Jan 2006 00:40 GMT
FWIW, all of Apple's header files use extern C bracketing.
Larry