SDL_loadso.h 2.8 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182
  1. /*
  2. Simple DirectMedia Layer
  3. Copyright (C) 1997-2020 Sam Lantinga <slouken@libsdl.org>
  4. This software is provided 'as-is', without any express or implied
  5. warranty. In no event will the authors be held liable for any damages
  6. arising from the use of this software.
  7. Permission is granted to anyone to use this software for any purpose,
  8. including commercial applications, and to alter it and redistribute it
  9. freely, subject to the following restrictions:
  10. 1. The origin of this software must not be misrepresented; you must not
  11. claim that you wrote the original software. If you use this software
  12. in a product, an acknowledgment in the product documentation would be
  13. appreciated but is not required.
  14. 2. Altered source versions must be plainly marked as such, and must not be
  15. misrepresented as being the original software.
  16. 3. This notice may not be removed or altered from any source distribution.
  17. */
  18. /**
  19. * \file SDL_loadso.h
  20. *
  21. * System dependent library loading routines
  22. *
  23. * Some things to keep in mind:
  24. * \li These functions only work on C function names. Other languages may
  25. * have name mangling and intrinsic language support that varies from
  26. * compiler to compiler.
  27. * \li Make sure you declare your function pointers with the same calling
  28. * convention as the actual library function. Your code will crash
  29. * mysteriously if you do not do this.
  30. * \li Avoid namespace collisions. If you load a symbol from the library,
  31. * it is not defined whether or not it goes into the global symbol
  32. * namespace for the application. If it does and it conflicts with
  33. * symbols in your code or other shared libraries, you will not get
  34. * the results you expect. :)
  35. */
  36. #ifndef SDL_loadso_h_
  37. #define SDL_loadso_h_
  38. #include "SDL_stdinc.h"
  39. #include "SDL_error.h"
  40. #include "begin_code.h"
  41. /* Set up for C function definitions, even when using C++ */
  42. #ifdef __cplusplus
  43. extern "C" {
  44. #endif
  45. /**
  46. * This function dynamically loads a shared object and returns a pointer
  47. * to the object handle (or NULL if there was an error).
  48. * The 'sofile' parameter is a system dependent name of the object file.
  49. */
  50. extern DECLSPEC void *SDLCALL SDL_LoadObject(const char *sofile);
  51. /**
  52. * Given an object handle, this function looks up the address of the
  53. * named function in the shared object and returns it. This address
  54. * is no longer valid after calling SDL_UnloadObject().
  55. */
  56. extern DECLSPEC void *SDLCALL SDL_LoadFunction(void *handle,
  57. const char *name);
  58. /**
  59. * Unload a shared object from memory.
  60. */
  61. extern DECLSPEC void SDLCALL SDL_UnloadObject(void *handle);
  62. /* Ends C function definitions when using C++ */
  63. #ifdef __cplusplus
  64. }
  65. #endif
  66. #include "close_code.h"
  67. #endif /* SDL_loadso_h_ */
  68. /* vi: set ts=4 sw=4 expandtab: */