This is the mail archive of the ecos-discuss@sources.redhat.com mailing list for the eCos project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: 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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]