Skip to content

Conversation

@mardy
Copy link
Collaborator

@mardy mardy commented Sep 26, 2024

With this change, the translation unit (TU) of functions.c gets brought
into the list of units used in the linking when a gc_gl.c's TU is used,
as confirmed by nm:

functions.o:
...
00000000 B _ogx_functions_c
00000000 T ogx_get_proc_address
...

gc_gl.o:
...
00000000 D _ogx_force_proctable
         U _ogx_functions_c
00000000 T ogx_initialize
...

As the comment in the code explains it, this allows us to support the
scenario where we use opengx in a client library (such as SDL) without
forcing a dependency on it in the client application. More precisely,
this change is made to support the case where an application does use
opengx via libSDL, to make so that the weak symbol for
ogx_get_proc_address() defined in libSDL gets overridden by the real one
(since the application is unlikely to use this function directly, but
it's indirectly used when SDL_GL_GetProcAddress() is called).

With this change, the translation unit (TU) of functions.c gets brought
into the list of units used in the linking when gc_gl.c's TU is used, as
confirmed by nm:

    functions.o:
    ...
    00000000 B _ogx_functions_c
    00000000 T ogx_get_proc_address
    ...

    gc_gl.o:
    ...
    00000000 D _ogx_force_proctable
             U _ogx_functions_c
    00000000 T ogx_initialize
    ...

As the comment in the code explains it, this allows us to support the
scenario where we use opengx in a client library (such as SDL) without
forcing a dependency on it in the client application. More precisely,
this change is made to support the case where an application *does use*
opengx via libSDL, to make so that the weak symbol for
ogx_get_proc_address() defined in libSDL gets overridden by the real one
(since the application is unlikely to use this function directly, but
it's indirectly used when SDL_GL_GetProcAddress() is called).
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants