wut/include/coreinit/dynload.h

75 lines
1.4 KiB
C
Raw Normal View History

2016-01-07 13:07:13 +01:00
#pragma once
#include <wut.h>
#include "thread.h"
#include "time.h"
2016-01-07 17:02:54 +01:00
/**
* \defgroup coreinit_dynload Dynamic Loading
* \ingroup coreinit
* @{
*/
2016-01-07 15:09:43 +01:00
#ifdef __cplusplus
extern "C" {
#endif
2016-01-07 13:07:13 +01:00
typedef void *OSDynLoadModule;
typedef int (*OSDynLoadAllocFn)(int size, int align, void **outAddr);
typedef void (*OSDynLoadFreeFn)(void *addr);
2016-01-07 17:02:54 +01:00
/**
* Set the allocator function to use for dynamic loading.
*/
2016-01-07 13:07:13 +01:00
int32_t
OSDynLoad_SetAllocator(OSDynLoadAllocFn allocFn,
OSDynLoadFreeFn freeFn);
2016-01-07 17:02:54 +01:00
/**
* Get the allocator function used for dynamic loading.
*/
2016-01-07 13:07:13 +01:00
int32_t
OSDynLoad_GetAllocator(OSDynLoadAllocFn *outAllocFn,
OSDynLoadFreeFn *outFreeFn);
2016-01-07 17:02:54 +01:00
/**
* Load a module.
*
* If the module is already loaded, increase reference count.
* Similar to LoadLibrary on Windows.
*/
2016-01-07 13:07:13 +01:00
int32_t
OSDynLoad_Acquire(char const *name,
OSDynLoadModule *outModule);
2016-01-07 17:02:54 +01:00
/**
* Retrieve the address of a function or data export from a module.
*
* Similar to GetProcAddress on Windows.
*/
2016-01-07 13:07:13 +01:00
int32_t
OSDynLoad_FindExport(OSDynLoadModule module,
int32_t isData,
char const *name,
void **outAddr);
2016-01-07 17:02:54 +01:00
/**
* Free a module handle returned from OSDynLoad_Acquire.
*
* Will decrease reference count and only unload the module if count reaches 0.
* Similar to FreeLibrary on Windows.
*/
2016-01-07 13:07:13 +01:00
void
OSDynLoad_Release(OSDynLoadModule module);
2016-01-07 15:09:43 +01:00
#ifdef __cplusplus
}
#endif
2016-01-07 17:02:54 +01:00
/** @} */