Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
Discussion Groups
General
GeneralPortable MacsHardwareNetworking
Applications
Mac ApplicationsEudoraFirefox / MozillaInternet ExplorerOutlook ExpressMS OfficeEntourageExcelPowerPointWordVirtual PCMedia PlayerOther MS Products
Programming
Mac ProgrammingCodeWarriorPerl
Country Specific
Australian Mac GroupUK Mac Group

Mac Forum / Programming / CodeWarrior / January 2006



Tip: Looking for answers? Try searching our database.

Importing GCC into CW

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Anonymous - 13 Jan 2006 00:40 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
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
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.