compiling static library issue - xcode

I'm creating a static library with some frameworks and a third part static library.
To avoid the conflicting problem, how to manage the static library when I release the library ?
And if my library users has import the same frameworks, when I compiling the static library, should I select the link binary?

Related

cmake, boost locale and a static library

I have two applications and a static library used by both.
All three using CMake as build system.
I want to localize my applications.
I more or less understand how to localize applications but I'm not
sure how I should localize my static library.
If it would be a dynamic library I could install the compiled
translations alongside with the binary and access them.
But a static library is only relevant for the developer. There is no longer a
library in the final product. I would somehow need to transfer the compiled
translations of the library to the applications.
When calling make install for one of my applications the translatons of my
static library needs to be installed, too.
How can I achieve something like this using CMake?

Howto use on bcc32 an static lib built with bcc32c

I need to use a C++11 library on a bcc32 project.
The library doesn't compile with bcc32, but does with bcc32c.
I would like to prevent exposing this library on a DLL. The library compiles with bcc32c, but I wasn't able to use bcc32c static libs on bcc32 projects.
Static libraries are compiler-specific. You cannot make a static lib in one compiler and use it in another compiler. Your only options are to either wrap the static lib inside a DLL, or else change the library's code to address whatever is preventing it from compiling in bcc32.

Static Library in a Project: Why the frameworks used by the static library needs to be added also to the Project?

I am developing a static library, which is added to my main project that tests the static library's functions. The static library inside is using some 3rd party components, and this third party components needs to add some additional libraries (e.g.: libz.dylib, SystemConfiguration.Framework). It's fine, but when I try to build my main project that contains my static library, I got bunch of linker errors. I figured out, if I add the same frameworks and libraries to the main projects what I needed to add to my static library, the linker errors disappear and the project is built succesfully. The question is do I really need to add all of those resources to the main Project? I find it crazy that if I give my static library to someone else to use, I need to include a bunch of frameworks and libraries in the documentation that has to be added also in the integrator project? Or am I missing something important?
It's because a static library is not linked, unlike an executable or dynamic library.
A static library is just an archive of object files, and object files contain external references to symbols they use. Those references are not resolved until the executable/dynamic library is linked.
Therefore when you link-in a static library you are responsible for providing any dependant libraries to the linker, which can themselves be either static or dynamic.

Qt - linking an external static lib that uses WinBase

I'm trying to build a GUI using Qt 5.3.1 and having that link to a static lib (built with VisualStudio 2010 using /MD and /MDd). When linking in QtCreator IDE, I get 2 unresolved external linker errors generated from these two function calls from within the static lib.
Both of these (unresolved) functions are declared in WinBase.h.
::InitializeSecurityDescriptor
::SetSecurityDescriptorDacl
What is the easiest solution to get QtCreator to compile this lib? Ideally if possible, I'd like to also link whatever dependency in the static lib itself.
As the documentation of both functions specifies, you have to link against advapi32.lib. In general, all functions of the Windows SDK specify in a box at the end of the documentation the header where they are declared, the header that you should actually include and their import library.
As for the other dependencies, AFAIK there's no way to know - static libraries are just collections of object modules, that specify their dependencies only in terms of imported functions.

Compiling a C++ library both as a static lib and dynamic dll with VS

I need to compile an existing C++ library both as a lib and a dll, and then use the static and dynamic libraries in different applications. I use VS2010.
What I can't do is to edit all the header files in order to add __declspec(dllexport) instructions to export, as the library must be kept as it is.
Under Mac I was able to compile and use a dylib without problems, but I know that VS is lacking in this regard.
In VS is it feasible to compile a static lib first and then a dll in order to have functions "exported" (i.e. linkable from an application at compilation time)? In other words, can I use the static lib as if was the export lib generated with __declspec(dllexport)?
Are there better workarounds?
I need to compile an existing C++ library both as a lib and a dll, and
then use the static and dynamic libraries in different applications. I
use VS2010.
Create configurations for that. For example Release LIB, Release DLL, etc.
What I can't do is to edit all the header files in order to add
__declspec(dllexport) instructions to export, as the library must be
kept as it is.
Simply add module definition file (*.def) with a list of exported functions.
In other words, can I use the static lib as if was the export lib
generated with __declspec(dllexport)?
No, those libs are different. When you build a DLL you get a binary and a lib files.

Resources