Questions tagged [static-libraries]

A static library is an archive of object files. Used as a linker input, the linker extracts the object files it needs to carry on the linkage.

The needed object files are those that provide the linker with definitions for symbols that it finds are used, without definition, in other input files. The needed object files, and no others, are extracted from the archive and input to the linkage exactly as if they were individual input files in the linkage command and the static library was not mentioned at all.

Linkers may differ as to whether the position of a static library in the sequence of input files affects its availability to be searched for needed object files. Some linkers (e.g. GNU ld) will search a static library only to obtain definitions for unresolved symbol references used in earlier input files. For such a linker, success requires a static library to be input after all other files that depend on it for symbol definitions. Other linkers (e.g. Microsoft link) will search a static library to obtain a definition for any otherwise unresolved symbol reference.

A linker will normally support an option (GNU ld: --whole-archive, MS link: /WHOLEARCHIVE) to override the default processing of static libraries and instead link all the contained object files, whether they are needed or not.

A static library contributes nothing to a linkage except the object files that are extracted from it, which may be vary in different linkages. It is to be contrasted with a shared library, another kind of file altogether with a very different role in linkage.

4482 questions
2
votes
1 answer

What is the right way to include sub bundles into main bundle iOS

I have the following situation, I am trying to make a framework that consist of sub projects, each sub project is a static library and a bundle. I am including those static libraries into the main project which is the framework, and also I need to…
Mohanad Kaleia
  • 793
  • 1
  • 9
  • 22
2
votes
0 answers

Duplicate error after added -ObjC linker flag

I'm integrating Google Maps SDK in my existing webrtc xcode project. It requires to add -ObjC linker flag, so i get a lot of duplicate error: duplicate symbol _OBJC_CLASS_$_ARDAppClient in: …
phuongle
  • 1,166
  • 11
  • 17
2
votes
2 answers

Same class name in library and project

If I have a class named ClassA in my main project, and I have a sub project built for a static library, in this sub project a class also named ClassA. I'm wonder that I can build and run successfully, how the compiler distinguish the two class?
riyousan
  • 23
  • 3
2
votes
0 answers

Static iOS library dependencies

I'm writing a static library for iOS. How can I use third-party libraries? CocoaPods works with libraries? Tried to import directly into my project but don't works. Xcode can't find it.
Simón Urzúa
  • 1,556
  • 2
  • 11
  • 16
2
votes
0 answers

How to get the version of iOS SDK that was used to build a static library?

I have a third-party static library and I need to know which SDK was used to build it. Other than asking the team that built it, is there any way to get this information. I know you can do it for frameworks but I have not figured out how to use this…
pgpb.padilla
  • 2,318
  • 2
  • 20
  • 44
2
votes
1 answer

Dynamic library image doesn't contain x86_64, i386 architectures

I'm trying to build dynamic library for iOS, combined with architectures armv7 armv7s arm64 i386 x86_64 Here is my target's Build Settings As you can see I've added x86_64 and i386 to Architectures and Valid Architectures, also Build Active…
l0gg3r
  • 8,864
  • 3
  • 26
  • 46
2
votes
0 answers

Convert compiled armv7 static library to arm64?

My iOS app uses a static library (*.a) from a vendor which no longer exists. I do not have the source code and cannot recompile the library for arm64. The problem is that Apple is now requiring apps to contain an arm64 slice. How can I use this…
Keith
  • 1,123
  • 9
  • 22
2
votes
1 answer

How to check if class is available or not in Static lib?

I will try to explain my problem. I am creating two libs home.a & room.a independently. From home lib I have calls to the functions which I implemented in room.a I am want two use this two libs in one project, the case is I want to keep room.a as…
OnkarK
  • 3,745
  • 2
  • 26
  • 33
2
votes
1 answer

DLL linking to static libraries

We have a project which is an executable, which loads DLL files at run time as plugins. We're trying to make a new plug in which has many library dependencies, and some of those dependencies are the same library but different versions that other…
Lynden Shields
  • 1,062
  • 1
  • 10
  • 27
2
votes
0 answers

C++/CLI: Compiling static library with /CLR support

We have old (working) code that consists of a static library compiled with /CLR, and a C++/CLI DLL that links to the static lib. We are about to add new features to this static lib. Now, I've have heard from numerous sources that CLR static…
Yodan Tauber
  • 3,907
  • 2
  • 27
  • 48
2
votes
2 answers

Creating a static library using Swift with external cocoa pods dependencies

I'm having trouble creating a swift static library which uses external cocoa pods libraries (SSZipArchive). I'm getting the following error: error: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/libtool:…
danielrvt
  • 10,177
  • 20
  • 80
  • 121
2
votes
2 answers

-[UIView setAdUnitID1:]: unrecognized selector sent to instance

I have created a static library of a UIView libLinOneSdk.a. So i am getting crash when i am using it's property or funcitons. but if i am using LinDFPBanner.m Everything is working fine, In Storyboard i have hooked it in nib also. I searched but got…
iOS
  • 213
  • 1
  • 14
2
votes
0 answers

From WPF development to ASP.NET development

I have a lot of experience developing rich WPF applications (for CRM scenarios). I am a single developer and use Visual Studio with a TFS for revision control. I have build a Framework which automatically takes care of the most basic tasks for me.…
themightylc
  • 304
  • 2
  • 15
2
votes
2 answers

Using Objective-C code in iOS Cocoa Static Library project with Swift code in iOS Application project

I am looking for a simple procedure for combining an Objective-C code from a shared library project with Swift code from an application project but have had no success so far with this sequence: start Xcode 6.1.1 create workspace Test create iOS…
Drux
  • 11,992
  • 13
  • 66
  • 116
2
votes
1 answer

How to add a static library to a project that uses cocoapods (iOS)

I have a project that uses cocoapods for some time. Recently, I bought an external library from a vendor. This library was sent to me as a static library (.a) and two headers files (.h). I imported both files and added the static libraries Build…
hdoria
  • 624
  • 2
  • 14
  • 29