Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

FR: use static instead of dynamic CALLs #1

Open
GitMensch opened this issue Apr 17, 2023 · 1 comment
Open

FR: use static instead of dynamic CALLs #1

GitMensch opened this issue Apr 17, 2023 · 1 comment

Comments

@GitMensch
Copy link

GitMensch commented Apr 17, 2023

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").

@tjpalmer
Copy link
Contributor

Thanks for the tips! I'll try to look into this soon.

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

No branches or pull requests

2 participants