This is the mail archive of the
ecos-discuss@sources.redhat.com
mailing list for the eCos project.
Re: user defined C++ function in eCOS question? Thanks alot.
- From: Bob Koninckx <bob dot koninckx at mech dot kuleuven dot ac dot be>
- To: jameshq at liverpool dot ac dot uk
- Cc: ecos-discuss at sources dot redhat dot com
- Date: 22 Apr 2003 18:58:59 +0200
- Subject: Re: [ECOS] user defined C++ function in eCOS question? Thanks alot.
- Organization: KULeuven
- References: <200304221633.h3MGXlf16344@webmail1.liv.ac.uk>
On Tue, 2003-04-22 at 18:33, jameshq at liverpool dot ac dot uk wrote:
> Hi all:
> I tried to use C++ function in C but I encounter the following
> problem:
> (What I trying here is to define some C++ functions(because I need to
> access the class object)
> and to be called in C, as kapi.cxx, kapi.h)
>
>
> File: a.h
> void create_obj();
>
>
> File: a.cxx
>
> #include <cyg/io/a.h>
>
> externC void create_obj()
> {
> int a;
> }
>
> while I tried to build the ecos library I got the following error
> message:
>
>
> /ecos-c/ecoscvs/current/src/a.cxx:3: syntax error before `void'
>
> It seems the externC keyword is not recognized here.
> what happen here?
> BTW what is the difference between externC and extern "C"?
I bet somewhere within eCos you can find a definition like
#ifdef __cplusplus
#define externC extern "C"
#else
#define externC
#endif
Like this, you can call the macro equally well from both C and C++
(which can be convenient if you use it in a header file)
Bob
>
> Thanks a lot.
--
----------------------------------------------------------------------
ir. Bob Koninckx
Katholieke Universiteit Leuven
Division Production Engineering, tel. +32 16 322535
Machine Design and Automation fax. +32 16 322987
Celestijnenlaan 300B bob dot koninckx at mech dot kuleuven dot ac dot be
B-3001 Leuven Belgium http://www.mech.kuleuven.ac.be/pma
----------------------------------------------------------------------
--
Before posting, please read the FAQ: http://sources.redhat.com/fom/ecos
and search the list archive: http://sources.redhat.com/ml/ecos-discuss