1/*
2 * zlibtclStubLib.c --
3 *
4 *	Stub object that will be statically linked into extensions that wish
5 *	to access the ZLIBTCL API.
6 *
7 * Copyright (c) 2002 Andreas Kupries <andreas_kupries@users.sourceforge.net>
8 * Copyright (c) 2002 Andreas Kupries <andreas_kupries@users.sourceforge.net>
9 *
10 * See the file "license.terms" for information on usage and redistribution
11 * of this file, and for a DISCLAIMER OF ALL WARRANTIES.
12 *
13 * RCS: @(#) $Id: zlibtclStubLib.c 274 2010-06-28 13:23:34Z nijtmans $
14 */
15
16#ifndef USE_TCL_STUBS
17#define USE_TCL_STUBS
18#endif
19
20#include "zlibtcl.h"
21
22const ZlibtclStubs *zlibtclStubsPtr;
23
24/*
25 *----------------------------------------------------------------------
26 *
27 * Zlibtcl_InitStubs --
28 *
29 *	Checks that the correct version of Blt is loaded and that it
30 *	supports stubs. It then initialises the stub table pointers.
31 *
32 * Results:
33 *	The actual version of BLT that satisfies the request, or
34 *	NULL to indicate that an error occurred.
35 *
36 * Side effects:
37 *	Sets the stub table pointers.
38 *
39 *----------------------------------------------------------------------
40 */
41
42#ifdef Zlibtcl_InitStubs
43#undef Zlibtcl_InitStubs
44#endif
45
46MODULE_SCOPE const char *
47Zlibtcl_InitStubs(
48	Tcl_Interp *interp,
49	const char *version,
50	int exact
51) {
52	const char *result;
53	void *data;
54
55	result = Tcl_PkgRequireEx(interp, PACKAGE_NAME, (CONST84 char *) version, exact, &data);
56	if (!result || !data) {
57		return NULL;
58	}
59
60	zlibtclStubsPtr = data;
61	return result;
62}
63