/*
 * jdll.h - interface to libjdll
 *
 * (C) 2000 Jess Haas
 * (C) 2000-2001 Jeffrey Bridge
 *  2001/03/04 - Olivier Dagenais - Removed "jdll_ScanDir" function
 *
 * This library is free software; you can redistribute it and/or
 * modify it under the terms of the GNU Lesser General Public
 * License as published by the Free Software Foundation; either
 * version 2.1 of the License, or (at your option) any later version.
 *
 * This library is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 * Lesser General Public License for more details.
 *
 * You should have received a copy of the GNU Lesser General Public
 * License along with this library; if not, write to the Free Software
 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
 */

#ifndef _JDLL_H
#define _JDLL_H

#ifdef WIN32
	/* Win32 */
	#define NOGDI
	#define WIN32_LEAN_AND_MEAN
	#include <windows.h>
	#define SHARED_LIB_EXT ".dll"
#else
#ifdef __BEOS__
	/* BeOS */
	#include <kernel/image.h>
	#define SHARED_LIB_EXT ""
#else
#ifdef HPUX
	/* HPUX */
	#include <dl.h>
	#define SHARED_LIB_EXT ".sl"
#else
	/* Other UNIX */
	#include <dlfcn.h>
	#define SHARED_LIB_EXT ".so"

	#ifndef RTLD_NOW
		#define RTLD_NOW 0
	#endif
	#ifndef RTLD_LAZY
		#define RTLD_LAZY 0
	#endif

	#include <unistd.h>
	#include <dirent.h>
	#include <sys/types.h>
	#include <sys/stat.h>
#endif /* HPUX */
#endif /* BeOS */
#endif /* win32 */

#include <stdio.h>
#include <stdlib.h>
#include <string.h>

#ifdef WIN32
#	define LIB_HANDLE HMODULE
#	define LINKAGE    __declspec(dllexport)
#else
#ifdef __BEOS__
#	define LIB_HANDLE image_id
#	define LINKAGE
#else
#ifdef HPUX
#	include <dl.h>
#	define LIB_HANDLE shl_t*
#	define LINKAGE
#else
#	define LIB_HANDLE void*
#	define LINKAGE
#endif /* HPUX */
#endif /* BeOS */
#endif /* win32 */

/* Set up for C function definitions, even when using C++ */
#ifdef __cplusplus
extern "C" {
#endif

LIB_HANDLE jdll_Load(const char *lib_name);
int jdll_Unload(LIB_HANDLE lib_handle);
void * jdll_GetSym(LIB_HANDLE lib_handle, char *symbol_name);

/* Ends C function definitions when using C++ */
#ifdef __cplusplus
};
#endif

#endif /* _JDLL_H */
