[ECOS] C Linkage for C++ Files

Fred Woolsey fwsbcon@fwsbcon.com
Tue Jan 7 06:53:00 GMT 2003


Hi Sai,

Thanks... I did some research after Greg's response and found just what you
so kindly explained... I appreciate it!  BTW- I have tried it and it does in
fact work just fine.

Cheers,
Fred Woolsey

----- Original Message -----
From: "sai jayram" <sai@cdotb.ernet.in>
To: "Greg Lanthier" <greg_lanthierca@yahoo.ca>
Cc: "Fred Woolsey" <fwsbcon@fwsbcon.com>; "ecos-discuss"
<ecos-discuss@sources.redhat.com>
Sent: Monday, January 06, 2003 11:36 PM
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
>
>
>
>



-- 
Before posting, please read the FAQ: http://sources.redhat.com/fom/ecos
and search the list archive: http://sources.redhat.com/ml/ecos-discuss



More information about the Ecos-discuss mailing list