SDL
3.0
SDL_loadso.h
Go to the documentation of this file.
1
/*
2
Simple DirectMedia Layer
3
Copyright (C) 1997-2024 Sam Lantinga <slouken@libsdl.org>
4
5
This software is provided 'as-is', without any express or implied
6
warranty. In no event will the authors be held liable for any damages
7
arising from the use of this software.
8
9
Permission is granted to anyone to use this software for any purpose,
10
including commercial applications, and to alter it and redistribute it
11
freely, subject to the following restrictions:
12
13
1. The origin of this software must not be misrepresented; you must not
14
claim that you wrote the original software. If you use this software
15
in a product, an acknowledgment in the product documentation would be
16
appreciated but is not required.
17
2. Altered source versions must be plainly marked as such, and must not be
18
misrepresented as being the original software.
19
3. This notice may not be removed or altered from any source distribution.
20
*/
21
22
/* WIKI CATEGORY: SharedObject */
23
24
/**
25
* # CategorySharedObject
26
*
27
* System-dependent library loading routines.
28
*
29
* Some things to keep in mind:
30
*
31
* - These functions only work on C function names. Other languages may have
32
* name mangling and intrinsic language support that varies from compiler to
33
* compiler.
34
* - Make sure you declare your function pointers with the same calling
35
* convention as the actual library function. Your code will crash
36
* mysteriously if you do not do this.
37
* - Avoid namespace collisions. If you load a symbol from the library, it is
38
* not defined whether or not it goes into the global symbol namespace for
39
* the application. If it does and it conflicts with symbols in your code or
40
* other shared libraries, you will not get the results you expect. :)
41
*/
42
43
#ifndef SDL_loadso_h_
44
#define SDL_loadso_h_
45
46
#include <
SDL3/SDL_stdinc.h
>
47
#include <
SDL3/SDL_error.h
>
48
49
#include <
SDL3/SDL_begin_code.h
>
50
/* Set up for C function definitions, even when using C++ */
51
#ifdef __cplusplus
52
extern
"C"
{
53
#endif
54
55
/**
56
* Dynamically load a shared object.
57
*
58
* \param sofile a system-dependent name of the object file.
59
* \returns an opaque pointer to the object handle or NULL on failure; call
60
* SDL_GetError() for more information.
61
*
62
* \since This function is available since SDL 3.0.0.
63
*
64
* \sa SDL_LoadFunction
65
* \sa SDL_UnloadObject
66
*/
67
extern
SDL_DECLSPEC
void
* SDLCALL
SDL_LoadObject
(
const
char
*sofile);
68
69
/**
70
* Look up the address of the named function in a shared object.
71
*
72
* This function pointer is no longer valid after calling SDL_UnloadObject().
73
*
74
* This function can only look up C function names. Other languages may have
75
* name mangling and intrinsic language support that varies from compiler to
76
* compiler.
77
*
78
* Make sure you declare your function pointers with the same calling
79
* convention as the actual library function. Your code will crash
80
* mysteriously if you do not do this.
81
*
82
* If the requested function doesn't exist, NULL is returned.
83
*
84
* \param handle a valid shared object handle returned by SDL_LoadObject().
85
* \param name the name of the function to look up.
86
* \returns a pointer to the function or NULL on failure; call SDL_GetError()
87
* for more information.
88
*
89
* \since This function is available since SDL 3.0.0.
90
*
91
* \sa SDL_LoadObject
92
*/
93
extern
SDL_DECLSPEC
SDL_FunctionPointer
SDLCALL
SDL_LoadFunction
(
void
*handle,
const
char
*name);
94
95
/**
96
* Unload a shared object from memory.
97
*
98
* \param handle a valid shared object handle returned by SDL_LoadObject().
99
*
100
* \since This function is available since SDL 3.0.0.
101
*
102
* \sa SDL_LoadObject
103
*/
104
extern
SDL_DECLSPEC
void
SDLCALL
SDL_UnloadObject
(
void
*handle);
105
106
/* Ends C function definitions when using C++ */
107
#ifdef __cplusplus
108
}
109
#endif
110
#include <
SDL3/SDL_close_code.h
>
111
112
#endif
/* SDL_loadso_h_ */
SDL_begin_code.h
SDL_close_code.h
SDL_error.h
SDL_LoadObject
void * SDL_LoadObject(const char *sofile)
SDL_UnloadObject
void SDL_UnloadObject(void *handle)
SDL_LoadFunction
SDL_FunctionPointer SDL_LoadFunction(void *handle, const char *name)
SDL_stdinc.h
SDL_FunctionPointer
void(* SDL_FunctionPointer)(void)
Definition
SDL_stdinc.h:3099
include
SDL3
SDL_loadso.h
Generated by
1.9.8