Skip to content

Commit

Permalink
Plugins|iOS|clang: API entry points must be exported symbols
Browse files Browse the repository at this point in the history
  • Loading branch information
skyjake committed May 6, 2017
1 parent 3e6b4a2 commit 858e9e5
Show file tree
Hide file tree
Showing 15 changed files with 45 additions and 32 deletions.
2 changes: 1 addition & 1 deletion doomsday/apps/api/apis.h
Expand Up @@ -185,7 +185,7 @@ typedef struct de_api_s {
#define DENG_USING_API(Name) DENG_EXTERN_C DENG_DECLARE_API(Name)

#define DENG_API_EXCHANGE(APIs) \
DENG_EXTERN_C void deng_API(int id, void *api) { \
DENG_EXTERN_C DENG_VISIBLE_SYMBOL void deng_API(int id, void *api) { \
switch(id) { APIs \
default: break; } }
#define DENG_GET_API(Ident, Name) \
Expand Down
1 change: 1 addition & 0 deletions doomsday/apps/plugins/PluginConfig.cmake
Expand Up @@ -34,6 +34,7 @@ macro (deng_add_plugin target)

if (APPLE)
if (IOS)
set_property (TARGET ${target} PROPERTY XCODE_ATTRIBUTE_DEAD_CODE_STRIPPING NO)
link_framework (${target} PUBLIC Foundation)
link_framework (${target} PUBLIC CoreFoundation)
link_framework (${target} PUBLIC MobileCoreServices)
Expand Down
10 changes: 5 additions & 5 deletions doomsday/apps/plugins/doom/src/d_api.cpp
Expand Up @@ -330,7 +330,7 @@ int G_RegisterGames(int hookType, int param, void *data)
/**
* Called right after the game plugin is selected into use.
*/
DENG_EXTERN_C void DP_Load(void)
DENG_EXTERN_C DENG_VISIBLE_SYMBOL void DP_Load(void)
{
Plug_AddHook(HOOK_VIEWPORT_RESHAPE, R_UpdateViewport);
gfw_SetCurrentGame(GFW_DOOM);
Expand All @@ -339,7 +339,7 @@ DENG_EXTERN_C void DP_Load(void)
/**
* Called when the game plugin is freed from memory.
*/
DENG_EXTERN_C void DP_Unload(void)
DENG_EXTERN_C DENG_VISIBLE_SYMBOL void DP_Unload(void)
{
Plug_RemoveHook(HOOK_VIEWPORT_RESHAPE, R_UpdateViewport);
}
Expand Down Expand Up @@ -375,7 +375,7 @@ dd_bool G_TryShutdown(void)
* Takes a copy of the engine's entry points and exported data. Returns
* a pointer to the structure that contains our entry points and exports.
*/
DENG_EXTERN_C game_export_t *GetGameAPI(void)
DENG_EXTERN_C DENG_VISIBLE_SYMBOL game_export_t *GetGameAPI(void)
{
// Clear all of our exports.
memset(&gx, 0, sizeof(gx));
Expand Down Expand Up @@ -427,7 +427,7 @@ DENG_EXTERN_C game_export_t *GetGameAPI(void)
* This function is called automatically when the plugin is loaded for the first time.
* We let the engine know what we'd like to do.
*/
DENG_EXTERN_C void DP_Initialize()
DENG_EXTERN_C DENG_VISIBLE_SYMBOL void DP_Initialize()
{
Plug_AddHook(HOOK_STARTUP, G_RegisterGames);
}
Expand All @@ -436,7 +436,7 @@ DENG_EXTERN_C void DP_Initialize()
* Declares the type of the plugin so the engine knows how to treat it. Called
* automatically when the plugin is loaded.
*/
DENG_EXTERN_C char const *deng_LibraryType(void)
DENG_EXTERN_C DENG_VISIBLE_SYMBOL char const *deng_LibraryType(void)
{
return "deng-plugin/game";
}
Expand Down
10 changes: 5 additions & 5 deletions doomsday/apps/plugins/doom64/src/d64_api.cpp
Expand Up @@ -85,7 +85,7 @@ int G_RegisterGames(int hookType, int param, void* data)
/**
* Called right after the game plugin is selected into use.
*/
DENG_EXTERN_C void DP_Load(void)
DENG_EXTERN_C DENG_VISIBLE_SYMBOL void DP_Load(void)
{
Plug_AddHook(HOOK_VIEWPORT_RESHAPE, R_UpdateViewport);
gfw_SetCurrentGame(GFW_DOOM64);
Expand All @@ -94,7 +94,7 @@ DENG_EXTERN_C void DP_Load(void)
/**
* Called when the game plugin is freed from memory.
*/
DENG_EXTERN_C void DP_Unload(void)
DENG_EXTERN_C DENG_VISIBLE_SYMBOL void DP_Unload(void)
{
Plug_RemoveHook(HOOK_VIEWPORT_RESHAPE, R_UpdateViewport);
}
Expand Down Expand Up @@ -130,7 +130,7 @@ dd_bool G_TryShutdown(void)
* Takes a copy of the engine's entry points and exported data. Returns
* a pointer to the structure that contains our entry points and exports.
*/
DENG_EXTERN_C game_export_t *GetGameAPI(void)
DENG_EXTERN_C DENG_VISIBLE_SYMBOL game_export_t *GetGameAPI(void)
{
// Clear all of our exports.
memset(&gx, 0, sizeof(gx));
Expand Down Expand Up @@ -182,7 +182,7 @@ DENG_EXTERN_C game_export_t *GetGameAPI(void)
* This function is called automatically when the plugin is loaded.
* We let the engine know what we'd like to do.
*/
DENG_EXTERN_C void DP_Initialize()
DENG_EXTERN_C DENG_VISIBLE_SYMBOL void DP_Initialize()
{
Plug_AddHook(HOOK_STARTUP, G_RegisterGames);
}
Expand All @@ -191,7 +191,7 @@ DENG_EXTERN_C void DP_Initialize()
* Declares the type of the plugin so the engine knows how to treat it. Called
* automatically when the plugin is loaded.
*/
DENG_EXTERN_C const char* deng_LibraryType(void)
DENG_EXTERN_C DENG_VISIBLE_SYMBOL const char* deng_LibraryType(void)
{
return "deng-plugin/game";
}
Expand Down
4 changes: 2 additions & 2 deletions doomsday/apps/plugins/example/src/example.c
Expand Up @@ -55,7 +55,7 @@ static int ExampleHook(int hookType, int parm, void *data)
* Declares the type of the plugin so the engine knows how to treat it. Called
* during plugin loading, before DP_Initialize().
*/
DENG_EXTERN_C char const *deng_LibraryType(void)
DENG_EXTERN_C DENG_VISIBLE_SYMBOL char const *deng_LibraryType(void)
{
return "deng-plugin/generic";
}
Expand All @@ -64,7 +64,7 @@ DENG_EXTERN_C char const *deng_LibraryType(void)
* This function is called automatically when the plugin is loaded. We let the
* engine know what we'd like to do.
*/
DENG_EXTERN_C void DP_Initialize(void)
DENG_EXTERN_C DENG_VISIBLE_SYMBOL void DP_Initialize(void)
{
Plug_AddHook(HOOK_STARTUP, ExampleHook);
}
Expand Down
2 changes: 1 addition & 1 deletion doomsday/apps/plugins/fmod/src/driver_fmod.cpp
Expand Up @@ -264,7 +264,7 @@ int DS_Set(int prop, const void* ptr)
* Declares the type of the plugin so the engine knows how to treat it. Called
* automatically when the plugin is loaded.
*/
DENG_EXTERN_C const char* deng_LibraryType(void)
DENG_EXTERN_C DENG_VISIBLE_SYMBOL const char* deng_LibraryType(void)
{
return "deng-plugin/audio";
}
Expand Down
10 changes: 5 additions & 5 deletions doomsday/apps/plugins/heretic/src/h_api.cpp
Expand Up @@ -130,7 +130,7 @@ int G_RegisterGames(int hookType, int param, void* data)
/**
* Called right after the game plugin is selected into use.
*/
DENG_EXTERN_C void DP_Load(void)
DENG_EXTERN_C DENG_VISIBLE_SYMBOL void DP_Load(void)
{
Plug_AddHook(HOOK_VIEWPORT_RESHAPE, R_UpdateViewport);
gfw_SetCurrentGame(GFW_HERETIC);
Expand All @@ -139,7 +139,7 @@ DENG_EXTERN_C void DP_Load(void)
/**
* Called when the game plugin is freed from memory.
*/
DENG_EXTERN_C void DP_Unload(void)
DENG_EXTERN_C DENG_VISIBLE_SYMBOL void DP_Unload(void)
{
Plug_RemoveHook(HOOK_VIEWPORT_RESHAPE, R_UpdateViewport);
}
Expand Down Expand Up @@ -175,7 +175,7 @@ dd_bool G_TryShutdown(void)
* Takes a copy of the engine's entry points and exported data. Returns
* a pointer to the structure that contains our entry points and exports.
*/
DENG_EXTERN_C game_export_t *GetGameAPI(void)
DENG_EXTERN_C DENG_VISIBLE_SYMBOL game_export_t *GetGameAPI(void)
{
// Clear all of our exports.
memset(&gx, 0, sizeof(gx));
Expand Down Expand Up @@ -228,7 +228,7 @@ DENG_EXTERN_C game_export_t *GetGameAPI(void)
* This function is called automatically when the plugin is loaded.
* We let the engine know what we'd like to do.
*/
DENG_EXTERN_C void DP_Initialize(void)
DENG_EXTERN_C DENG_VISIBLE_SYMBOL void DP_Initialize(void)
{
Plug_AddHook(HOOK_STARTUP, G_RegisterGames);
}
Expand All @@ -237,7 +237,7 @@ DENG_EXTERN_C void DP_Initialize(void)
* Declares the type of the plugin so the engine knows how to treat it. Called
* automatically when the plugin is loaded.
*/
DENG_EXTERN_C char const *deng_LibraryType(void)
DENG_EXTERN_C DENG_VISIBLE_SYMBOL char const *deng_LibraryType(void)
{
return "deng-plugin/game";
}
Expand Down
10 changes: 5 additions & 5 deletions doomsday/apps/plugins/hexen/src/x_api.cpp
Expand Up @@ -167,7 +167,7 @@ int G_RegisterGames(int, int, void *)
/**
* Called right after the game plugin is selected into use.
*/
DENG_EXTERN_C void DP_Load(void)
DENG_EXTERN_C DENG_VISIBLE_SYMBOL void DP_Load(void)
{
Plug_AddHook(HOOK_VIEWPORT_RESHAPE, R_UpdateViewport);
gfw_SetCurrentGame(GFW_HEXEN);
Expand All @@ -176,7 +176,7 @@ DENG_EXTERN_C void DP_Load(void)
/**
* Called when the game plugin is freed from memory.
*/
DENG_EXTERN_C void DP_Unload(void)
DENG_EXTERN_C DENG_VISIBLE_SYMBOL void DP_Unload(void)
{
Plug_RemoveHook(HOOK_VIEWPORT_RESHAPE, R_UpdateViewport);
}
Expand Down Expand Up @@ -212,7 +212,7 @@ dd_bool G_TryShutdown(void)
* Takes a copy of the engine's entry points and exported data. Returns
* a pointer to the structure that contains our entry points and exports.
*/
DENG_EXTERN_C game_export_t *GetGameAPI(void)
DENG_EXTERN_C DENG_VISIBLE_SYMBOL game_export_t *GetGameAPI(void)
{
// Clear all of our exports.
memset(&gx, 0, sizeof(gx));
Expand Down Expand Up @@ -264,7 +264,7 @@ DENG_EXTERN_C game_export_t *GetGameAPI(void)
* This function is called automatically when the plugin is loaded.
* We let the engine know what we'd like to do.
*/
DENG_EXTERN_C void DP_Initialize(void)
DENG_EXTERN_C DENG_VISIBLE_SYMBOL void DP_Initialize(void)
{
Plug_AddHook(HOOK_STARTUP, G_RegisterGames);
}
Expand All @@ -273,7 +273,7 @@ DENG_EXTERN_C void DP_Initialize(void)
* Declares the type of the plugin so the engine knows how to treat it. Called
* automatically when the plugin is loaded.
*/
DENG_EXTERN_C char const *deng_LibraryType(void)
DENG_EXTERN_C DENG_VISIBLE_SYMBOL char const *deng_LibraryType(void)
{
return "deng-plugin/game";
}
Expand Down
2 changes: 1 addition & 1 deletion doomsday/apps/plugins/importdeh/include/importdeh.h
Expand Up @@ -33,7 +33,7 @@ struct font_s;
#include <de/libcore.h>
#include <de/types.h>

DENG_EXTERN_C void DP_Initialize();
DENG_EXTERN_C DENG_VISIBLE_SYMBOL void DP_Initialize();

// Internal:
extern ded_t *ded; // @todo Remove me.
Expand Down
4 changes: 2 additions & 2 deletions doomsday/apps/plugins/importdeh/src/importdeh.cpp
Expand Up @@ -177,7 +177,7 @@ int DefsHook(int /*hook_type*/, int /*parm*/, void *data)
* This function is called automatically when the plugin is loaded.
* We let the engine know what we'd like to do.
*/
void DP_Initialize()
DENG_EXTERN_C DENG_VISIBLE_SYMBOL void DP_Initialize()
{
Plug_AddHook(HOOK_DEFS, DefsHook);
}
Expand All @@ -186,7 +186,7 @@ void DP_Initialize()
* Declares the type of the plugin so the engine knows how to treat it. Called
* automatically when the plugin is loaded.
*/
extern "C" char const *deng_LibraryType()
DENG_EXTERN_C DENG_VISIBLE_SYMBOL char const *deng_LibraryType()
{
return "deng-plugin/generic";
}
Expand Down
4 changes: 2 additions & 2 deletions doomsday/apps/plugins/importidtech1/src/importidtech1.cpp
Expand Up @@ -128,7 +128,7 @@ int ConvertMapInfoHook(int /*hookType*/, int /*parm*/, void *context)
* This function is called automatically when the plugin is loaded.
* We let the engine know what we'd like to do.
*/
extern "C" void DP_Initialize()
DENG_EXTERN_C DENG_VISIBLE_SYMBOL void DP_Initialize()
{
Plug_AddHook(HOOK_MAP_CONVERT, ConvertMapHook);
Plug_AddHook(HOOK_MAPINFO_CONVERT, ConvertMapInfoHook);
Expand All @@ -138,7 +138,7 @@ extern "C" void DP_Initialize()
* Declares the type of the plugin so the engine knows how to treat it. Called
* automatically when the plugin is loaded.
*/
extern "C" char const *deng_LibraryType()
DENG_EXTERN_C DENG_VISIBLE_SYMBOL char const *deng_LibraryType()
{
return "deng-plugin/generic";
}
Expand Down
4 changes: 2 additions & 2 deletions doomsday/apps/plugins/importudmf/src/importudmf.cpp
Expand Up @@ -331,7 +331,7 @@ static int importMapHook(int /*hookType*/, int /*parm*/, void *context)
* This function is called automatically when the plugin is loaded.
* We let the engine know what we'd like to do.
*/
extern "C" void DP_Initialize()
DENG_EXTERN_C DENG_VISIBLE_SYMBOL void DP_Initialize()
{
Plug_AddHook(HOOK_MAP_CONVERT, importMapHook);
}
Expand All @@ -340,7 +340,7 @@ extern "C" void DP_Initialize()
* Declares the type of the plugin so the engine knows how to treat it. Called
* automatically when the plugin is loaded.
*/
extern "C" char const *deng_LibraryType()
DENG_EXTERN_C DENG_VISIBLE_SYMBOL char const *deng_LibraryType()
{
return "deng-plugin/generic";
}
Expand Down
2 changes: 1 addition & 1 deletion doomsday/apps/plugins/openal/src/driver_openal.cpp
Expand Up @@ -508,7 +508,7 @@ int DS_SFX_Getv(int /*prop*/, void* /*values*/)
* Declares the type of the plugin so the engine knows how to treat it. Called
* automatically when the plugin is loaded.
*/
DENG_EXTERN_C const char* deng_LibraryType(void)
DENG_EXTERN_C DENG_VISIBLE_SYMBOL const char* deng_LibraryType(void)
{
return "deng-plugin/audio";
}
Expand Down
6 changes: 6 additions & 0 deletions doomsday/sdk/libcore/include/de/libcore.h
Expand Up @@ -156,6 +156,12 @@
# define DENG2_NORETURN __attribute__((__noreturn__))
#endif

#if defined (DENG_IOS)
# define DENG2_VISIBLE_SYMBOL __attribute__((visibility("default")))
#else
# define DENG2_VISIBLE_SYMBOL
#endif

#ifndef NDEBUG
# define DENG2_DEBUG
DENG2_EXTERN_C DENG2_PUBLIC void LogBuffer_Flush(void);
Expand Down
6 changes: 6 additions & 0 deletions doomsday/sdk/liblegacy/include/de/liblegacy.h
Expand Up @@ -77,6 +77,12 @@
# define DENG_NORETURN __attribute__((__noreturn__))
#endif

#if defined (DENG_IOS)
# define DENG_VISIBLE_SYMBOL __attribute__((visibility("default")))
#else
# define DENG_VISIBLE_SYMBOL
#endif

#if !defined(_MSC_VER)
#endif

Expand Down

0 comments on commit 858e9e5

Please sign in to comment.