[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: dpkg-1.6.1: Ack!



On Sat, Dec 04, 1999 at 02:11:58PM -0500, Simon Kirby wrote:
> I decided to use libdpkg over libapt because I am not familiar with C++,
> and libapt seems to be making use of C++ heavily.

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.

(From my experience with just the versioncmp stuff, libapt's is *muchly*
preferable: it's significantly faster, and doesn't leave dangling chunks
of memory lying about)

Cheers,
aj

-- 
Anthony Towns <aj@humbug.org.au> <http://azure.humbug.org.au/~aj/>
I don't speak for anyone save myself. GPG encrypted mail preferred.

 ``The thing is: trying to be too generic is EVIL. It's stupid, it 
        results in slower code, and it results in more bugs.''
                                        -- Linus Torvalds

Attachment: pgpaUWb7FWk3T.pgp
Description: PGP signature


Reply to: