This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
REF: c & C++
- To: "'gcc-bugs at gcc dot gnu dot org'" <gcc-bugs at gcc dot gnu dot org>
- Subject: REF: c & C++
- From: Derek Coleman <Derek dot Coleman at meluksoft dot co dot uk>
- Date: Mon, 24 Jul 2000 10:04:17 +0100
From: Derek E Coleman M.Eng (Elec & Comp Sci), I.Eng MIIE(elec).
Email <mailto:Derek.Coleman@meluksoft.co.uk>
Date: Monday 24th July 2000
Hi
I wonder if someone can help me.
My source code project is large. It consists of old C source files, written
by others and new C++ source I wish to link with old C in other files.
My problem follows:
I have to compile C with -x c and C++ with -x c++. Otherwise the old
code throws up errors. If I try and compile the old code via c++ the, strict
type checking stops the compilation. Using -x c allows me to compile
sucessfully.
The problem then arises due to the name mangling with c++. C cant link to
them, one way around this is use
extern "C"{
some_function_prototype
}
but if my function is in a class, the old C functions cant link with it, and
the following produces errors
class some_class{
public:
extern "C"{
some_function_prototype
}
};
I cant re-write all the old source code, theres loads of it.
Any ideas?
Regards
Derek