1/*
2 *  dlf.h
3 *
4 *  $Id: dlf.h 2613 1999-06-01 15:32:12Z VZ $
5 *
6 *  Dynamic Library Loader (mapping to SVR4)
7 *
8 *  The iODBC driver manager.
9 *
10 *  Copyright (C) 1995 by Ke Jin <kejin@empress.com>
11 *
12 *  This library is free software; you can redistribute it and/or
13 *  modify it under the terms of the GNU Library General Public
14 *  License as published by the Free Software Foundation; either
15 *  version 2 of the License, or (at your option) any later version.
16 *
17 *  This library is distributed in the hope that it will be useful,
18 *  but WITHOUT ANY WARRANTY; without even the implied warranty of
19 *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
20 *  Library General Public License for more details.
21 *
22 *  You should have received a copy of the GNU Library General Public
23 *  License along with this library; if not, write to the Free
24 *  Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
25 */
26#ifndef	_DLF_H
27#define _DLF_H
28#include	"config.h"
29
30#if defined(HAVE_LIBDL)
31#define DLDAPI_SVR4_DLFCN
32#elif defined(HAVE_SHL_LOAD)
33#define DLDAPI_HP_SHL
34#endif
35
36#ifdef DLDAPI_SVR4_DLFCN
37#include	<dlfcn.h>
38#elif DLDAPI_AIX_LOAD
39#include	<dlfcn.h>
40#else
41extern void FAR *dlopen (char FAR * path, int mode);
42extern void FAR *dlsym (void FAR * hdll, char FAR * sym);
43extern char FAR *dlerror ();
44extern int dlclose (void FAR * hdll);
45#endif
46
47#ifndef	RTLD_LAZY
48#define	RTLD_LAZY       1
49#endif
50
51#define	DLL_OPEN(dll)		(void*)dlopen((char*)(path), RTLD_LAZY)
52#define	DLL_PROC(hdll, sym)	(void*)dlsym((void*)(hdll), (char*)sym)
53#define	DLL_ERROR()		(char*)dlerror()
54#define	DLL_CLOSE(hdll)		dlclose((void*)(hdll))
55#endif
56