sdlloadso.inc 2.8 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576
  1. //from sdl_loadso.h
  2. {*
  3. * \file SDL_loadso.h
  4. *
  5. * System dependent library loading routines
  6. *
  7. * Some things to keep in mind:
  8. * \li These functions only work on C function names. Other languages may
  9. * have name mangling and intrinsic language support that varies from
  10. * compiler to compiler.
  11. * \li Make sure you declare your function pointers with the same calling
  12. * convention as the actual library function. Your code will crash
  13. * mysteriously if you do not do this.
  14. * \li Avoid namespace collisions. If you load a symbol from the library,
  15. * it is not defined whether or not it goes into the global symbol
  16. * namespace for the application. If it does and it conflicts with
  17. * symbols in your code or other shared libraries, you will not get
  18. * the results you expect.:)
  19. }
  20. {*
  21. * Dynamically load a shared object.
  22. *
  23. * \param sofile a system-dependent name of the object file
  24. * \returns an opaque pointer to the object handle or nil if there was an
  25. * error; call SDL_GetError() for more information.
  26. *
  27. * \since This function is available since SDL 2.0.0.
  28. *
  29. * \sa SDL_LoadFunction
  30. * \sa SDL_UnloadObject
  31. }
  32. function SDL_LoadObject(sofile: PAnsiChar): Pointer; cdecl;
  33. external {$IFDEF DYNAMIC_LINK}SDL_LibName{$ENDIF} {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_LoadObject' {$ENDIF} {$ENDIF};
  34. {*
  35. * Look up the address of the named function in a shared object.
  36. *
  37. * This function pointer is no longer valid after calling SDL_UnloadObject().
  38. *
  39. * This function can only look up C function names. Other languages may have
  40. * name mangling and intrinsic language support that varies from compiler to
  41. * compiler.
  42. *
  43. * Make sure you declare your function pointers with the same calling
  44. * convention as the actual library function. Your code will crash
  45. * mysteriously if you do not do this.
  46. *
  47. * If the requested function doesn't exist, nil is returned.
  48. *
  49. * \param handle a valid shared object handle returned by SDL_LoadObject()
  50. * \param name the name of the function to look up
  51. * \returns a pointer to the function or nil if there was an error; call
  52. * SDL_GetError() for more information.
  53. *
  54. * \since This function is available since SDL 2.0.0.
  55. *
  56. * \sa SDL_LoadObject
  57. * \sa SDL_UnloadObject
  58. }
  59. function SDL_LoadFunction(handle: Pointer; name: PAnsiChar): Pointer; cdecl;
  60. external {$IFDEF DYNAMIC_LINK}SDL_LibName{$ENDIF} {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_LoadFunction' {$ENDIF} {$ENDIF};
  61. {*
  62. * Unload a shared object from memory.
  63. *
  64. * \param handle a valid shared object handle returned by SDL_LoadObject()
  65. *
  66. * \since This function is available since SDL 2.0.0.
  67. *
  68. * \sa SDL_LoadFunction
  69. * \sa SDL_LoadObject
  70. }
  71. procedure SDL_UnloadObject(handle: Pointer); cdecl;
  72. external {$IFDEF DYNAMIC_LINK}SDL_LibName{$ENDIF} {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_UnloadObject' {$ENDIF} {$ENDIF};