aboutsummaryrefslogtreecommitdiffstats
path: root/code/platform_unix/unix_library_wrapper.h
blob: b358ce3467534fad8232b9712c4a7232b7898958 (plain) (blame)
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
39
40
/*
 * Mr. 4th Dimention - Allen Webster
 *
 * 18.07.2017
 *
 * Linux library wrapper.
 *
 */

// TOP

#error IS THIS STILL REAL? (February 27th 2020)

union Library{
    void *lib;
    FixSize(LIBRARY_TYPE_SIZE);
};

internal b32
system_load_library_direct(Library *library, char *name){
    AssertLibrarySizes();
    library->lib = dlopen(name, RTLD_LAZY);
    b32 success = (library->lib != 0);
    return(success);
}

internal void*
system_get_proc(Library *library, char *name){
    void *result = dlsym(library->lib, name);
    return(result);
}

internal void
system_free_library(Library *library){
    dlclose(library->lib);
    library->lib = 0;
}

// BOTTOM