Azure / azure-storage-cpplite

Lite version of C++ Client Library for Microsoft Azure Storage
MIT License
25 stars 44 forks source link

Same name for static and shared libraries #110

Open davidbrochart opened 3 years ago

davidbrochart commented 3 years ago

Would it be possible to have a different name for the static and the shared libraries? We are having an issue when packaging azure-storage-cpplite for conda-forge on Windows (see https://github.com/conda-forge/staged-recipes/pull/13417).

katmsft commented 3 years ago

https://github.com/conda-forge/staged-recipes/pull/13417#discussion_r540274829

Copying relevant comments for more info:

When you build a shared library for xxx on Windows, two files are generated: xxx.dll, which contains the code to execute, and xxx.lib which contains the exported symbols, use to link with. The issue is that if you build a static library for xxx with the default options, you also generate a xxx.lib (not the same content as the previous one, but the same name and same location). If you install both shared and static packages, the latter.lib file overwirtes the former. Therefore, you need to use different names for static and share libraries. Besides, applications linking with a static library should use the same runtime as that of the static library. It is therefore a common pattern to specify the runtime of the static library in its name.

katmsft commented 3 years ago

Personally, I don't think it is a huge problem to change static libraries to have other names, however, could you point us to a sample project that's using different names for static/dynamic libraries? Also, is there a universally adapted pattern for dynamic/static library names?

davidbrochart commented 3 years ago

Maybe @johanmabille knows more about the name pattern?

JohanMabille commented 3 years ago

There is no single stadard naming convention; one I often see is libname-mt-s-version.lib or libname-mt-s.lib (here the mt part means multi-threaded, opposed to md used for building DLL, s means static linking).

katmsft commented 3 years ago

@Jinming-Hu I don't have a problem with this. What do you think.

Jinming-Hu commented 3 years ago

Fine by me.

katmsft commented 3 years ago

BTW, if we do that, how would it change the way customers consume the static library? They have to explicitly import libname-s.lib instead?

davidbrochart commented 3 years ago

I think so, yes.

JohanMabille commented 3 years ago

They have to explicitly import libname-s.lib instead?

Yes

katmsft commented 3 years ago

We welcome community contribution on this, the name should be azure-storage-lite-s.lib given the dynamic linking library's name is azure-storage-lite.lib