hlsdk-portable icon indicating copy to clipboard operation
hlsdk-portable copied to clipboard

Static builds support?

Open MoeMod opened this issue 4 years ago • 8 comments

Related: MoeMod/CSMoE#64 switchports/xash3d-switch#11

  1. make a export function table
  2. 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.

MoeMod avatar Nov 02 '19 17:11 MoeMod

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.

a1batross avatar Nov 02 '19 18:11 a1batross

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

mittorn avatar Nov 02 '19 18:11 mittorn

Does objcopy --keep-symbol (for each exports) --discard-all solve this?

mittorn avatar Nov 02 '19 18:11 mittorn

https://stackoverflow.com/questions/2980102/combine-two-gcc-compiled-o-object-files-into-a-third-o-file This should help

mittorn avatar Nov 02 '19 19:11 mittorn

We need try to implement it in wscript if this really works and add code for export registration and entity lookup

mittorn avatar Nov 02 '19 19:11 mittorn

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.

MoeMod avatar Nov 03 '19 11:11 MoeMod

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)

mittorn avatar Nov 04 '19 13:11 mittorn

Some work has been done in xash3d-fwgs, I guess this should be closed now?

a1batross avatar Mar 02 '20 00:03 a1batross