#ifndef RT_DYNAMIC_LIBS_H
#define RT_DYNAMIC_LIBS_H

#include "runtime.h"

#ifdef __cplusplus
extern "C" {
#endif

#ifdef _WIN32
#define RT_DLLNAME(s)                                                                              \
    (".\\"s                                                                                        \
     ".dll")
#elif defined(__linux__)
#define RT_DLLNAME(s)                                                                              \
    ("./lib"s                                                                                      \
     ".so")
#endif

typedef void *rt_dynlib;

RT_DLLEXPORT rt_dynlib rtOpenLib(const char *libname);

RT_DLLEXPORT rt_dynlib rtOpenCallerLib(void);

RT_DLLEXPORT void *rtGetSymbol(rt_dynlib lib, const char *symbol);

RT_DLLEXPORT void rtCloseLib(rt_dynlib lib);

#ifdef __cplusplus
}
#endif

#endif
