Skip to content

Commit

Permalink
Add OS structure for dynamic modules that utilize the engine.
Browse files Browse the repository at this point in the history
  • Loading branch information
DreamyCecil committed Jun 12, 2024
1 parent 5bf6327 commit de22950
Showing 1 changed file with 25 additions and 0 deletions.
25 changes: 25 additions & 0 deletions Sources/Engine/OS/OS.h
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,31 @@ class ENGINE_API OS {
void Destroy(void);
};

// Depending on build configuration this structure can either be:
// - A handle to a dynamic module
// - A dummy for a static module
struct EngineModule {
HMODULE hHandle;

EngineModule(HMODULE hOther = NULL) : hHandle(hOther) {};

inline BOOL IsLoaded(void) { return hHandle != NULL; };
inline void Load(const char *strLibrary) { hHandle = LoadLib(strLibrary); };
inline void LoadOrThrow_t(const char *strLibrary) { hHandle = LoadLibOrThrow_t(strLibrary); };

inline BOOL Free(void) {
if (!IsLoaded()) return FALSE;
BOOL bReturn = FreeLib(hHandle);
hHandle = NULL;
return bReturn;
};

inline EngineModule &operator=(const EngineModule &hOther) {
hHandle = hOther.hHandle;
return *this;
};
};

// Dynamic library methods
public:

Expand Down

0 comments on commit de22950

Please sign in to comment.