From 5d37b6096afe4cb76571b32a95f4aca5f98572ec Mon Sep 17 00:00:00 2001 From: Tor Andersson Date: Thu, 29 Aug 2013 15:27:45 +0200 Subject: Add FZ_VERSION define. Check header and library version compatibility. --- source/fitz/context.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) (limited to 'source/fitz/context.c') diff --git a/source/fitz/context.c b/source/fitz/context.c index c65377a8..72ea2d6a 100644 --- a/source/fitz/context.c +++ b/source/fitz/context.c @@ -121,10 +121,16 @@ cleanup: } fz_context * -fz_new_context(fz_alloc_context *alloc, fz_locks_context *locks, unsigned int max_store) +fz_new_context_imp(fz_alloc_context *alloc, fz_locks_context *locks, unsigned int max_store, const char *version) { fz_context *ctx; + if (strcmp(version, FZ_VERSION)) + { + fprintf(stderr, "cannot create context: incompatible header (%s) and library (%s) versions", version, FZ_VERSION); + return NULL; + } + if (!alloc) alloc = &fz_alloc_default; -- cgit v1.2.3