hlsdk-portable
hlsdk-portable copied to clipboard
Static builds support?
Related: MoeMod/CSMoE#64 switchports/xash3d-switch#11
- make a export function table
- avoid duplicated symbols Switchports uses marcos and I wrap all codes into namespaces to avoid duplicated symbols between client and server. Maybe there are some better ways.
Ideally, I wanted a solution based on linker's features, but I don't know if they are exist... Yes, it's not portable, but it allows us to provide zero-line solution for mods.
Maybe build HLSDK as static library? When you're linking .a
library you usually don't struggle from multiple definitions.
symbols from static library not exported from output binary, but i do not know if it solve conflicts. It is possible to rename symbols in output files, but only in elf
Does objcopy --keep-symbol (for each exports) --discard-all solve this?
https://stackoverflow.com/questions/2980102/combine-two-gcc-compiled-o-object-files-into-a-third-o-file This should help
We need try to implement it in wscript if this really works and add code for export registration and entity lookup
I wonder whether there is one way to automatically #include<ns_begin.h> at the beginning and #include<ns_end.h> at end to warp everything into namespaces.
And who will generate ns_begin and ns_end for each mod? We will not make full static link support in code level for hlsdk because static linking is illegal (engine is GPL), but i think, it is possible for engine modules and mods not based on hlsdk (there is no such mods now, but i think, it is possible to clean quake remake/quake wrapper code or write server+client based on quake* or from scratch) And if we write some waf module to make libraries as relocatable (.o file), someone may enable it in hlsdk and link on own machine (distribution of hlsdk linked with engine is illegal because it must be distributed under GPL)
Some work has been done in xash3d-fwgs, I guess this should be closed now?