Skip to content

FR: use static instead of dynamic CALLs #1

@GitMensch

Description

@GitMensch

call 'SDL_Init' using by value sdl-init-video

You very likely want to request every CALL 'literal' to be generated as static call - to do so just pass -static on the cobc command line (which then also drops the need for the "do_not_call_me" function) and drops a bit of the CALL overhead, too.

Otherwise explicit specify a so called CALL-CONVENTION, possibly the embedded one call static 'SDL_INIT using ...`.

BTW: I've enjoyed your video on this game a lot, thanks for sharing your experience!

... and just to note: the reason why you needed that function when using dynamic calls is that the linker removes the "unused" libraries for you (you likely see that with ldd game, too) so they just weren't there at the run time (you could "preload" them, but in your case you really want those in).
You can tell the linker to not to this (and tell cobc to pass this request to the linker) by cobc--A "-Wl,--no-as-needed" -lSDL2 ... (but the linker won't get the idea to optimize those out if your calls to the library are static what this issue is about, so "just to let you know").

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions