summaryrefslogtreecommitdiffstats
path: root/source/core/platform.h
blob: fef698e6fcdff610fbdd1c956f080e66fd15fbd9 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
// platform.h
#ifndef SLANG_CORE_PLATFORM_H_INCLUDED
#define SLANG_CORE_PLATFORM_H_INCLUDED

namespace Slang
{
	// Interface for working with shared libraries
	// in a platfomr-independent fashion.
	struct SharedLibrary
	{
		typedef struct SharedLibraryImpl* Handle;
		Handle handle;

		// Attempt to load a shared library for
		// the current platform.
		static SharedLibrary load(char const* name);

		// If this refers to a valid loaded library,
		// then attempt to unload it
		void unload();

		typedef void (*FuncPtr)(void);

		FuncPtr findFuncByName(char const* name);


		operator Handle() { return handle; }
	};

#ifndef _MSC_VER
	#define _fileno fileno
	#define _isatty isatty
	#define _setmode setmode
	#define _O_BINARY O_BINARY
#endif
}

#endif