mirror of
https://github.com/ClassiCube/ClassiCube.git
synced 2025-09-18 03:55:19 -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) { }
|
||||
#else
|
||||
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* verSymbol; /* EXPORT int Plugin_ApiVersion = GAME_API_VER; */
|
||||
void* compSymbol; /* EXPORT struct IGameComponent Plugin_Component = { (whatever) } */
|
||||
@ -388,7 +380,7 @@ static void Game_LoadPlugin(const String* path, void* obj) {
|
||||
ReturnCode res;
|
||||
|
||||
/* 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);
|
||||
if (res) { Logger_DynamicLibWarn2(res, "loading plugin", path); return; }
|
||||
|
||||
|
@ -1339,6 +1339,8 @@ ReturnCode Updater_GetBuildTime(TimeMS* ms) {
|
||||
*-------------------------------------------------------Dynamic lib-------------------------------------------------------*
|
||||
*#########################################################################################################################*/
|
||||
#if defined CC_BUILD_WIN
|
||||
const String DynamicLib_Ext = String_FromConst(".dll");
|
||||
|
||||
ReturnCode DynamicLib_Load(const String* path, void** lib) {
|
||||
TCHAR str[NATIVE_STR_LEN];
|
||||
Platform_ConvertString(str, path);
|
||||
@ -1359,6 +1361,13 @@ ReturnCode DynamicLib_Load(const String* path, void** lib) { return ERR_NOT_SUPP
|
||||
ReturnCode DynamicLib_Get(void* lib, const char* name, void** symbol) { return ERR_NOT_SUPPORTED; }
|
||||
bool DynamicLib_DescribeError(ReturnCode res, String* dst) { return false; }
|
||||
#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) {
|
||||
char str[NATIVE_STR_LEN];
|
||||
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 */
|
||||
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. */
|
||||
CC_API ReturnCode DynamicLib_Load(const String* path, void** lib);
|
||||
/* Attempts to get the address of the symbol in the given dynamic library. */
|
||||
|
Loading…
x
Reference in New Issue
Block a user