1/* 2 * bz2lib.c -- 3 * 4 * Loader for 'bz2' compression library. 5 * 6 * Copyright (c) 1996 Jan Nijtmans (Jan.Nijtmans.wxs.nl) 7 * All rights reserved. 8 * 9 * CVS: $Id: bz2lib.c,v 1.5 2008/12/11 19:04:25 andreas_kupries Exp $ 10 */ 11 12#include "transformInt.h" 13 14#ifndef BZ2_LIB_NAME 15# ifdef __WIN32__ 16# define BZ2_LIB_NAME "libbz2.dll" 17# endif /* __WIN32__ */ 18# ifdef __APPLE__ 19# define BZ2_LIB_NAME "libbz2.dylib" 20# endif /* __APPLE__ */ 21# ifndef BZ2_LIB_NAME 22# define BZ2_LIB_NAME "libbz2.so" 23# endif /* BZ2_LIB_NAME */ 24#endif /* BZ2_LIB_NAME */ 25 26 27static char* symbols [] = { 28 "BZ2_bzCompress", 29 "BZ2_bzCompressEnd", 30 "BZ2_bzCompressInit", 31 "BZ2_bzDecompress", 32 "BZ2_bzDecompressEnd", 33 "BZ2_bzDecompressInit", 34 (char *) NULL 35}; 36 37 38/* 39 * Global variable containing the vectors into the 'bz2'-library. 40 */ 41 42#ifdef BZLIB_STATIC_BUILD 43bzFunctions bz = { 44 0, 45 bzCompress, 46 bzCompressEnd, 47 bzCompressInit, 48 bzDecompress, 49 bzDecompressEnd, 50 bzDecompressInit, 51}; 52#else 53bzFunctions bz = {0}; /* THREADING: serialize initialization */ 54#endif 55 56 57int 58TrfLoadBZ2lib (interp) 59 Tcl_Interp* interp; 60{ 61#ifndef BZLIB_STATIC_BUILD 62 int res; 63 64 TrfLock; /* THREADING: serialize initialization */ 65 66 res = Trf_LoadLibrary (interp, BZ2_LIB_NAME, (VOID**) &bz, symbols, 6); 67 TrfUnlock; 68 69 return res; 70#else 71 return TCL_OK; 72#endif 73} 74