Mail Archives: djgpp/1996/10/31/21:05:23
un1t AT rz DOT uni-karlsruhe DOT de (Matthias Baas) wrote:
>Hi,
>I have a problem with libraries and C/C++. Is there a difference
>between a library for C and a library for C++?
Yes... there's a difference, in fact, in the way the names of things
are stored in object files, library files, and debug information. It's
called C++ name mangling, and it basically means that the names
actually used have things stuck on the end.
For example:
int MyFunc(char *ch);
in C compiles to somethign called _MyFunc, whereas in C++ it ends up
looking more like _MyFunc^*£$£%some_garbage%^$"%...
To join C things to C++ things, use this syntax:
extern "C" int MyFunc(char *ch);
which tells the compiler you want to use the old C notation. If you go
through the header files for libpng and stick "C" after every Extern
you see, things should be nicer.
ABW
---
COMPUTER: We are in position over the Rebel homeworld.
VADAR: Engage the Death Star primary weapon, let those rebel worms die!
COMPUTER: Sorry, your evaluation version of Battle Computer 3.0 has expired.
Please send 2.6 billion dollars to the address in REGISTER.TXT
Alaric B. Williams Internet : alaric AT abwillms DOT demon DOT co DOT uk
<A HREF="http://www.abwillms.demon.co.uk/">Hello :-)</A>
- Raw text -