 |
C++Talk.NET C++ language newsgroups
|
| View previous topic :: View next topic |
| Author |
Message |
Michael Rasmussen Guest
|
Posted: Mon Jan 30, 2006 9:00 am Post subject: Making C++ classes available for C |
|
|
Hi all,
How do you make modules written i C++ available for C?
Until now I have done it this way:
foo.h
class foo {
public:
int bar();
}
foo.cc
int foo::bar()
{
return 1;
}
foo_c.h
int foo_c();
foo_c.cc
#include "foo.h"
foo f;
int foo_c()
{
return f.bar();
}
main.c
#include "foo_c.h"
int main()
{
printf("%d\n", foo_c());
return 0;
}
Any other suggestions?
--
Hilsen/Regards
Michael Rasmussen
http://keyserver.veridis.com:11371/pks/lookup?op=get&search=0xE3E80917 |
|
| Back to top |
|
 |
Bob Hairgrove Guest
|
Posted: Mon Jan 30, 2006 10:00 am Post subject: Re: Making C++ classes available for C |
|
|
On Mon, 30 Jan 2006 09:52:34 +0100, Michael Rasmussen <mir (AT) miras (DOT) org>
wrote:
| Quote: | How do you make modules written i C++ available for C?
|
Read it in the FAQ:
http://www.parashift.com/c++-faq-lite/mixing-c-and-cpp.html
--
Bob Hairgrove
NoSpamPlease (AT) Home (DOT) com |
|
| Back to top |
|
 |
Michael Rasmussen Guest
|
|
| Back to top |
|
 |
|
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum
|
|