zeroc-ice / ice

All-in-one solution for creating networked applications with RPC, pub/sub, server deployment, and more.
https://zeroc.com
GNU General Public License v2.0
2.01k stars 592 forks source link

Include SO version in C++98 static libraries #1507

Closed pepone closed 2 weeks ago

pepone commented 10 months ago
          Yes, we use the static libraries for building the compilers, but we do not distribute them.

I will revert and add a 3.8 TODO just to be safe.

_Originally posted by @pepone in https://github.com/zeroc-ice/ice/pull/1504#discussion_r1320261061_

jvbsl commented 10 months ago

Who uses the static libraries for C++98? Because I don't know how that could work on windows with the current state, because the c++98 static library naming for building does not contain the SO_VERSION, while the #pragma comment(lib, "...") does. Meaning if you would link to ice.lib(the correct name for the static library) through headers MSVC would automatically try to link ice37.lib which does not exist(at least not for static). So either it finds the shared library(don't know if that would work cause of duplicate symbols) or it can't find ice37.lib as a static lib and it won't be able to link. At least as far as I can tell, tell me if I overlooked something^^

https://github.com/zeroc-ice/ice/pull/1504 Did not change that behaviour(as far as I can tell was reverted), meaning that problem is not introduced with the PR, but was already there before

bernardnormier commented 10 months ago

This issue is admittedly confusing; maybe you misread it?

Ice 3.7 C++ does not support building static libraries on Windows in general, but uses static libraries to build the Slice compilers (the Slice compilers are "C++98" code).

1504 did not change the naming of C++98 libraries for Ice 3.7, in an abundance of caution. Maybe it's not warranted since it's unlikely anything other than the Slice compiler build uses these static library / static library build. But it's cleaner to err on the side of compatibility on the 3.7 branch.

This issue #1507 is about fixing this discrepancy for Ice 3.8, i.e. for 3.8, we want to use the same ice38[++11].lib name for static libraries and DLL import libraries... even if the static libraries are rarely used / not supported.

jvbsl commented 10 months ago

Oh ok, that's what you meant. https://github.com/zeroc-ice/ice/blob/24e6ac1659defa5cd8c60edde0392b3685f460a2/cpp/include/IceUtil/Config.h#L301 I think it works, because ICE_LIBNAME is not used to link to the static library using pragma, when you build the slice compilers. But don't know how it would be for other places where ICE_LIBNAME is used. So I think as well, that it is indeed better to err on the side of caution. But you also need to be aware of that for 3.8, if you want the C++98 bindings to be statically linkable by other projects. I mean for me personally it is fine if it's only cpp bindings/with ice 3.8 only. And I know that it isn't officially supported, but in the current state it seems the only reasons for that are the naming, so all in all it doesn't seem to be far of from being usable. I already tried it on Linux and it worked with the c++11 bindings. So still nice to have :D