DynamicLibrary

Cross-platform shared library loader

It

Platform-specific dynamic library handle

#if defined(_WIN32) || defined(_WIN64)
struct It {
  HINSTANCE handle
  I8* name
  U8 isValid
}
#else
struct It {
  U0* handle
  I8* name
  U8 isValid
}
#endif

load

Load a shared library by name or path

DynamicLibrary.It load(const I8* name)

Parameters

  • name — Library name or path

Returns — Library object — check isValid before use


get

Retrieve a function pointer from a loaded library

U0* get(DynamicLibrary dll, const I8* functionName)

Parameters

  • dll — The dynamic library
  • functionName — The exported symbol name

Returns — Raw function pointer — cast before calling


unload

Unload a dynamic library and free its resources

U0 unload(DynamicLibrary dll)

Parameters

  • dll — The dynamic library