mirror of
https://github.com/ClassiCube/ClassiCube.git
synced 2025-09-19 04:26:52 -04:00
Move platform-specific dynamic lib default file extension out of Game.c and into Platform.c where it belongs
This commit is contained in:
parent
7cfd8a8570
commit
be20b6d093
10
src/Game.c
10
src/Game.c
@ -373,14 +373,6 @@ static void Game_LoadOptions(void) {
|
|||||||
static void Game_LoadPlugins(void) { }
|
static void Game_LoadPlugins(void) { }
|
||||||
#else
|
#else
|
||||||
static void Game_LoadPlugin(const String* path, void* obj) {
|
static void Game_LoadPlugin(const String* path, void* obj) {
|
||||||
#if defined CC_BUILD_WIN
|
|
||||||
static const String ext = String_FromConst(".dll");
|
|
||||||
#elif defined CC_BUILD_OSX
|
|
||||||
static const String ext = String_FromConst(".dylib");
|
|
||||||
#else
|
|
||||||
static const String ext = String_FromConst(".so");
|
|
||||||
#endif
|
|
||||||
|
|
||||||
void* lib;
|
void* lib;
|
||||||
void* verSymbol; /* EXPORT int Plugin_ApiVersion = GAME_API_VER; */
|
void* verSymbol; /* EXPORT int Plugin_ApiVersion = GAME_API_VER; */
|
||||||
void* compSymbol; /* EXPORT struct IGameComponent Plugin_Component = { (whatever) } */
|
void* compSymbol; /* EXPORT struct IGameComponent Plugin_Component = { (whatever) } */
|
||||||
@ -388,7 +380,7 @@ static void Game_LoadPlugin(const String* path, void* obj) {
|
|||||||
ReturnCode res;
|
ReturnCode res;
|
||||||
|
|
||||||
/* ignore accepted.txt, deskop.ini, .pdb files, etc */
|
/* ignore accepted.txt, deskop.ini, .pdb files, etc */
|
||||||
if (!String_CaselessEnds(path, &ext)) return;
|
if (!String_CaselessEnds(path, &DynamicLib_Ext)) return;
|
||||||
res = DynamicLib_Load(path, &lib);
|
res = DynamicLib_Load(path, &lib);
|
||||||
if (res) { Logger_DynamicLibWarn2(res, "loading plugin", path); return; }
|
if (res) { Logger_DynamicLibWarn2(res, "loading plugin", path); return; }
|
||||||
|
|
||||||
|
@ -1339,6 +1339,8 @@ ReturnCode Updater_GetBuildTime(TimeMS* ms) {
|
|||||||
*-------------------------------------------------------Dynamic lib-------------------------------------------------------*
|
*-------------------------------------------------------Dynamic lib-------------------------------------------------------*
|
||||||
*#########################################################################################################################*/
|
*#########################################################################################################################*/
|
||||||
#if defined CC_BUILD_WIN
|
#if defined CC_BUILD_WIN
|
||||||
|
const String DynamicLib_Ext = String_FromConst(".dll");
|
||||||
|
|
||||||
ReturnCode DynamicLib_Load(const String* path, void** lib) {
|
ReturnCode DynamicLib_Load(const String* path, void** lib) {
|
||||||
TCHAR str[NATIVE_STR_LEN];
|
TCHAR str[NATIVE_STR_LEN];
|
||||||
Platform_ConvertString(str, path);
|
Platform_ConvertString(str, path);
|
||||||
@ -1355,10 +1357,17 @@ bool DynamicLib_DescribeError(ReturnCode res, String* dst) {
|
|||||||
return Platform_DescribeError(res, dst);
|
return Platform_DescribeError(res, dst);
|
||||||
}
|
}
|
||||||
#elif defined CC_BUILD_WEB
|
#elif defined CC_BUILD_WEB
|
||||||
ReturnCode DynamicLib_Load(const String* path, void** lib) { return ERR_NOT_SUPPORTED; }
|
ReturnCode DynamicLib_Load(const String* path, void** lib) { return ERR_NOT_SUPPORTED; }
|
||||||
ReturnCode DynamicLib_Get(void* lib, const char* name, void** symbol) { return ERR_NOT_SUPPORTED; }
|
ReturnCode DynamicLib_Get(void* lib, const char* name, void** symbol) { return ERR_NOT_SUPPORTED; }
|
||||||
bool DynamicLib_DescribeError(ReturnCode res, String* dst) { return false; }
|
bool DynamicLib_DescribeError(ReturnCode res, String* dst) { return false; }
|
||||||
#elif defined CC_BUILD_POSIX
|
#elif defined CC_BUILD_POSIX
|
||||||
|
/* TODO: Should we use .bundle instead of .dylib? */
|
||||||
|
#ifdef CC_BUILD_OSX
|
||||||
|
const String DynamicLib_Ext = String_FromConst(".dylib");
|
||||||
|
#else
|
||||||
|
const String DynamicLib_Ext = String_FromConst(".so");
|
||||||
|
#endif
|
||||||
|
|
||||||
ReturnCode DynamicLib_Load(const String* path, void** lib) {
|
ReturnCode DynamicLib_Load(const String* path, void** lib) {
|
||||||
char str[NATIVE_STR_LEN];
|
char str[NATIVE_STR_LEN];
|
||||||
Platform_ConvertString(str, path);
|
Platform_ConvertString(str, path);
|
||||||
|
@ -73,6 +73,8 @@ CC_API ReturnCode Updater_Start(void);
|
|||||||
/* Returns the last time the application was modified, as number of milliseconds since 1/1/0001 */
|
/* Returns the last time the application was modified, as number of milliseconds since 1/1/0001 */
|
||||||
CC_API ReturnCode Updater_GetBuildTime(TimeMS* ms);
|
CC_API ReturnCode Updater_GetBuildTime(TimeMS* ms);
|
||||||
|
|
||||||
|
/* The default file extension used for dynamic libraries on this platform. */
|
||||||
|
extern const String DynamicLib_Ext;
|
||||||
/* Attempts to load a native dynamic library from the given path. */
|
/* Attempts to load a native dynamic library from the given path. */
|
||||||
CC_API ReturnCode DynamicLib_Load(const String* path, void** lib);
|
CC_API ReturnCode DynamicLib_Load(const String* path, void** lib);
|
||||||
/* Attempts to get the address of the symbol in the given dynamic library. */
|
/* Attempts to get the address of the symbol in the given dynamic library. */
|
||||||
|
Loading…
x
Reference in New Issue
Block a user