This is the mail archive of the
ecos-discuss@sources.redhat.com
mailing list for the eCos project.
Re: C Linkage for C++ Files
- From: sai jayram <sai at cdotb dot ernet dot in>
- To: Greg Lanthier <greg_lanthierca at yahoo dot ca>
- Cc: Fred Woolsey <fwsbcon at fwsbcon dot com>, ecos-discuss <ecos-discuss at sources dot redhat dot com>
- Date: Tue, 7 Jan 2003 09:36:23 +0500 (GMT+0500)
- Subject: Re: [ECOS] C Linkage for C++ Files
On Mon, 6 Jan 2003, Greg Lanthier wrote:
> It wouldn't be as simple as wrapping the relevant C++
> code in 'extern "C"' decls, would it?
This works. I have used such things in my code.
ex: if you want to call a function named "function_in_cplus()" written in
C++ from a C routine, then the following will do.
C function
---
---
---
function_in_cplus();
---
---
---
c++ file
extern "C"
{
function_in_cplus();
}
function_in_cplus()
{
----
----
----
---
}
>
> Greg
>
> --- Fred Woolsey <fwsbcon@fwsbcon.com> wrote: > Hi
> all,
> >
> > Can anyone help explain how to go about compiling a
> > C++ file with C linkage?
> > The eCos reference manual makes a reference to
> > this... Is there a switch or
> > a #pragma for this?
> >
> > Thanks and Best Regards,
> > Fred Woolsey
> >
> >
> >
> > --
> > Before posting, please read the FAQ:
> > http://sources.redhat.com/fom/ecos
> > and search the list archive:
> > http://sources.redhat.com/ml/ecos-discuss
> >
>
> ______________________________________________________________________
> Post your free ad now! http://personals.yahoo.ca
>
> --
> Before posting, please read the FAQ: http://sources.redhat.com/fom/ecos
> and search the list archive: http://sources.redhat.com/ml/ecos-discuss
>
>
--
Before posting, please read the FAQ: http://sources.redhat.com/fom/ecos
and search the list archive: http://sources.redhat.com/ml/ecos-discuss