Skip to content

Commit f1d4573

Browse files
authored
ogc: define weak symbols for opengx functions (#82)
This allows building a client application without linking to opengx, if the client itself does not need OpenGL. The opengx functions used by SDL are defined as weak, so that they will be used only if a strong symbol is not found during linking. $ nm /opt/devkitpro/portlibs/wii/lib/libSDL2.a | grep ogx 00000000 W ogx_get_proc_address 00000000 W ogx_initialize Partial fix for #81
1 parent c56247f commit f1d4573

File tree

1 file changed

+15
-0
lines changed

1 file changed

+15
-0
lines changed

src/video/ogc/SDL_ogcgl.c

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,21 @@ typedef struct
3535
int swap_interval;
3636
} OGC_GL_Context;
3737

38+
/* Weak symbols for the opengx functions used by SDL, so that the client does
39+
* not need to link to opengx, unless it actually uses OpenGL. */
40+
void __attribute__((weak)) ogx_initialize(void)
41+
{
42+
SDL_LogWarn(SDL_LOG_CATEGORY_VIDEO,
43+
"%s() called but opengx not used in build!", __func__);
44+
}
45+
46+
void __attribute__((weak)) *ogx_get_proc_address(const char *)
47+
{
48+
SDL_LogWarn(SDL_LOG_CATEGORY_VIDEO,
49+
"%s() called but opengx not used in build!", __func__);
50+
return NULL;
51+
}
52+
3853
int SDL_OGC_GL_LoadLibrary(_THIS, const char *path)
3954
{
4055
return 0;

0 commit comments

Comments
 (0)