On Mon, 6 Dec 1999, Anthony Towns wrote:

> You can interface to C++ from C without too much trouble: doing things like,
> 
> apt_c_version.cc:
>       #include <apt-pkg/version.h>
>       extern "C" {
>       int versioncmp(char *left, char *right) {
>               return pkgVersionCompare(left, right);
>       }
>       }
 
> and then using versioncmp("1.2-3", "0.3-5") as you would strcmp() from C.
> You need to be a little cleverer at abstracting objects when you need
> to pass them around, and use void*'s and such, but it's not too tricky.

Eww, that's gross - You'd be better just to compiler you C code using the
C++ compiler and not use any C++ features. You might notice the compiler
is a bit more demanding, but that is about all.

Jason

Reply via email to