OSDN Git Service

Add SwiftShader dump from Feb 6 2013
[android-x86/external-swiftshader.git] / src / Common / SharedLibrary.hpp
1 // SwiftShader Software Renderer\r
2 //\r
3 // Copyright(c) 2005-2012 TransGaming Inc.\r
4 //\r
5 // All rights reserved. No part of this software may be copied, distributed, transmitted,\r
6 // transcribed, stored in a retrieval system, translated into any human or computer\r
7 // language by any means, or disclosed to third parties without the explicit written\r
8 // agreement of TransGaming Inc. Without such an agreement, no rights or licenses, express\r
9 // or implied, including but not limited to any patent rights, are granted to you.\r
10 //\r
11 \r
12 #if defined(_WIN32)\r
13         #include <Windows.h>\r
14 #else\r
15         #include <dlfcn.h>\r
16 #endif\r
17 \r
18 #if defined(_WIN32)\r
19         inline void *loadLibrary(const char *path)\r
20         {\r
21                 return (void*)LoadLibrary(path);\r
22         }\r
23 \r
24         inline void freeLibrary(void *library)\r
25         {\r
26                 FreeLibrary((HMODULE)library);\r
27         }\r
28 \r
29         inline void *getProcAddress(void *library, const char *name)\r
30         {\r
31                 return (void*)GetProcAddress((HMODULE)library, name);\r
32         }\r
33 #else\r
34         inline void *loadLibrary(const char *path)\r
35         {\r
36                 return dlopen(path, RTLD_LAZY);\r
37         }\r
38 \r
39         inline void freeLibrary(void *library)\r
40         {\r
41                 dlclose(library);\r
42         }\r
43 \r
44         inline void *getProcAddress(void *library, const char *name)\r
45         {\r
46                 return dlsym(library, name);\r
47         }\r
48 #endif\r