This is the mail archive of the
ecos-discuss@sources.redhat.com
mailing list for the eCos project.
RE: Dose eCos support C++ or only C?
- To: <ecos-discuss at sources dot redhat dot com>
- Subject: RE: [ECOS] Dose eCos support C++ or only C?
- From: "Dan Conti" <danc at iobjects dot com>
- Date: Tue, 2 Oct 2001 13:21:58 -0700
eCos supports C++ just fine, but it expects your entry point (i.e.
cyg_user_start, or main) to be a C-style function, i.e. no name
mangling. Running your code through the C++ compiler wont generate the
proper symbol by default. You need to explicitly state that you want C
style naming for your routine:
extern "C" void cyg_user_start(void);
or
extern "C" int main( void );
Just toss that in your source file right in front of your
implementation.
> -----Original Message-----
> From: Chris Sekula [mailto:chriss@turnpikeglobal.com]
> Sent: Tuesday, October 02, 2001 1:11 PM
> To: ecos-discuss@sources.redhat.com
> Subject: [ECOS] Dose eCos support C++ or only C?
>
>
> Does eCos support C++ or only C?
>
> We've developed a protoype board based upon the Cirrus Logic EBD 7312
> dev. board. I wrote some code in C, using the eCos API, to test the
> serial ports and IO lines. Everything worked well on the
> board. However,
> I'd prefer to write my applications in C++. I wrote a simple
> serial port
> class to test the serial ports. My test program compiled using the
> arm-elf-g++ compiler without errors. However, it didn't run on the
> board. I didn't see any glaring errors in my code, so I
> decided to take
> my C program and compile it with the arm-elf-g++ compiler. This time,
> the C program that had worked previously didn't work on the board.
>
> Is there a simple explanation for this (eg. is there a C++ config.
> option in the Configuration tool)?
>
> Thanks for any assistance,
>
> CHRIS.
>