Newer
Older
libkc / modules / include / kc_dl.h
  1. /**
  2. * @file kc_dl.h
  3. * @brief 動的ライブラリモジュールヘッダファイル
  4. * @copyright 2002 - 2023 Nomura Kei
  5. * @depends
  6. * kc.h
  7. */
  8. #ifndef KC_DL_H
  9. #define KC_DL_H
  10.  
  11. #include <kc.h>
  12.  
  13. #ifdef __cplusplus
  14. extern "C"
  15. {
  16. namespace kc
  17. {
  18. using namespace std;
  19. #endif
  20.  
  21. #if (KC_IS_WINDOWS)
  22. typedef HINSTANCE dl_handle_t;
  23. #else
  24. #include <dlfcn.h>
  25. typedef void *dl_handle_t;
  26. #endif
  27.  
  28. /**
  29. * 指定された動的ライブラリをオープンします。
  30. *
  31. * @param filename 動的ライブラリのファイル名
  32. */
  33. dl_handle_t KcDl_open(const char *filename);
  34.  
  35. /**
  36. * 動的ライブラリの関数を取得します。
  37. *
  38. * @param handle ハンドル
  39. * @param symbol 関数のシンボル名
  40. * @return 関数
  41. */
  42. void *KcDl_sym(dl_handle_t handle, const char *symbol);
  43.  
  44. /**
  45. * 動的ライブラリをクローズします。
  46. *
  47. * @param handle クローズするハンドル
  48. */
  49. bool KcDl_close(dl_handle_t handle);
  50.  
  51. #ifdef __cplusplus
  52. } // namespace kc
  53. } // extern "C"
  54. #endif
  55. #endif // KC_DL_H