File:  [Synchronet] / sbbs / src / xpdev / xp_dl.h
Revision 1.1.1.1 (vendor branch): download - view: text, annotated - select for diffs
Tue Apr 24 16:45:41 2018 UTC (8 years, 3 months ago) by root
Branches: digitaldynamics, MAIN
CVS tags: v_315b, HEAD
3.15b

#ifndef _XP_DL_H_
#define _XP_DL_H_

#include "wrapdll.h"

#ifndef STATIC_LINK
#if defined(__unix__)
	#include <dlfcn.h>

	typedef void * dll_handle;
	DLLEXPORT dll_handle DLLCALL xp_dlopen(const char **name, int mode, int major);
	#define xp_dlsym(handle, name)				dlsym(handle, #name)
	#define xp_dlclose(handle)					dlclose(handle)
#elif defined(_WIN32)
	#include <Windows.h>

	typedef HMODULE dll_handle;
	DLLEXPORT dll_handle DLLCALL xp_dlopen(const char **name, int mode, int major);
	#define xp_dlsym(handle, name)				((void *)GetProcAddress(handle, #name))
	#define xp_dlclose(handle)					(FreeLibrary(handle)?0:-1)

	/* Unused values for *nix compatability */
	enum {
		 RTLD_LAZY
		,RTLD_NOW
		,RTLD_GLOBAL
		,RTLD_LOCAL
		,RTLD_TRACE
	};
#endif
#else
	typedef void* dll_handle;

	#define xp_dlopen(name, mode, major)	(name)
	#define xp_dlsym(handle, name)			(name)
	#define xp_dlclose(handle)				(0)
#endif

#endif

unix.superglobalmegacorp.com

This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.