Subversion Repositories Kolibri OS

Rev

Rev 4358 | Go to most recent revision | Show entire file | Regard whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 4358 Rev 5080
Line 28... Line 28...
28
 
28
 
29
 
29
 
Line 30... Line -...
30
#include "pipe/p_config.h"
-
 
31
#include "pipe/p_compiler.h"
-
 
32
 
-
 
33
#if defined(PIPE_OS_UNIX)
-
 
34
#include 
-
 
35
#endif
-
 
Line 36... Line 30...
36
#if defined(PIPE_OS_WINDOWS)
30
#include "pipe/p_config.h"
37
#include 
31
#include "pipe/p_compiler.h"
Line -... Line 32...
-
 
32
 
-
 
33
 
Line 38... Line 34...
38
#endif
34
#include "u_dl.h"
39
 
35
#include "u_pointer.h"
40
#include "u_dl.h"
36
 
41
#include "u_pointer.h"
-
 
42
 
-
 
43
 
-
 
44
struct util_dl_library *
37
void* load_library(const char *name);
45
util_dl_open(const char *filename)
-
 
46
{
-
 
47
#if defined(PIPE_OS_UNIX)
-
 
48
   return (struct util_dl_library *)dlopen(filename, RTLD_LAZY | RTLD_GLOBAL);
38
void *get_proc_address(void *module, const char *proc_name);
Line 49... Line 39...
49
#elif defined(PIPE_OS_WINDOWS)
39
 
50
   return (struct util_dl_library *)LoadLibraryA(filename);
40
struct util_dl_library *
51
#else
41
util_dl_open(const char *filename)
52
   return NULL;
42
{
53
#endif
-
 
54
}
-
 
55
 
-
 
56
 
43
   return (struct util_dl_library *)load_library(filename);
57
util_dl_proc
-
 
58
util_dl_get_proc_address(struct util_dl_library *library,
-
 
59
                         const char *procname)
-
 
60
{
44
}
Line 61... Line 45...
61
#if defined(PIPE_OS_UNIX)
45
 
62
   return (util_dl_proc) pointer_to_func(dlsym((void *)library, procname));
46
 
63
#elif defined(PIPE_OS_WINDOWS)
47
util_dl_proc
64
   return (util_dl_proc)GetProcAddress((HMODULE)library, procname);
-
 
65
#else
-
 
66
   return (util_dl_proc)NULL;
-
 
67
#endif
-
 
68
}
-
 
69
 
48
util_dl_get_proc_address(struct util_dl_library *library,
70
 
-
 
71
void
49
                         const char *procname)
Line 72... Line 50...
72
util_dl_close(struct util_dl_library *library)
50
{
73
{
51
   return (util_dl_proc)get_proc_address(library, procname);
74
#if defined(PIPE_OS_UNIX)
52
}
75
   dlclose((void *)library);
-
 
76
#elif defined(PIPE_OS_WINDOWS)
-
 
77
   FreeLibrary((HMODULE)library);
-
 
78
#else
53
 
79
   (void)library;
-
 
80
#endif
-
 
81
}
-
 
82
 
54