static-libraries

Singleton class in a static library

北慕城南 提交于 2019-12-03 09:59:22
问题 Suppose I have a singleton class S in a static library, this could be linked with the other dynamic libraries D1 D2 D3, So from what I understand the class S will have a separate instance in each D1, D2 and D3 and this would be true even if it is not a singleton (like global) Is there any way to prevent multiple copies of class S? I cannot put the singleton S in another Dynamic library. Executable / | \ \ D1 D2 D3 D4 | | | S S S EDIT: The singleton S is in a separate static library that links

Initializing qt resources embedded in static library

蹲街弑〆低调 提交于 2019-12-03 09:13:08
问题 I have next situation: I need to create widget in standalone static library, which then will be linked with final application (visual c++ 9.0, qt 4.5). This static widget library contains some resources (icons), and consist of a several .cpp files (each contains standalone widget). As far as I know, i must initialize qt resource system, if i use them (resources) in static library, with call to "Q_INIT_RESOURCE( resource_file_name )". I solved this with next code (in every .cpp file in static

What are best practices to decrease the size of static libraries in objective-c?

萝らか妹 提交于 2019-12-03 09:04:42
问题 In building an objective-c static library, I noticed that the .a file (fat file from simulator and iPhone) is quite large. In particular, it was originally 5.7mb. I found this post and set my build settings Generate Debug Symbols to No, decreasing the lib size to 1.7mb. This was a big improvement, but is there anything else that can be done? The implementation and header files alone take up ~100kb. 回答1: In case it's part of your concern, a static library is just the relevant .o files archived

How to import Objective C static library to Swift Framework?

你。 提交于 2019-12-03 08:53:52
问题 I’m writing a dynamic Framework ( Proto.framework ) for OS X in Swift. I want to include code from a static library ( libstat.a ) which is written in Objective C. Here’s what I’ve got: // Dynamic.swift in Proto.framework class Dynamic { func doSomethingWithStat() { Stat().statThing() } } // Stat.h in libstat.a static library @interface Stat : NSObject - (void)statThing; @end // Stat.m @implementation Stat - (void)statThing { NSLog(@"OK"); } @end In my target for Proto.framework, I have linked

Duplicate symbols (two projects in a workspace use the same code)

陌路散爱 提交于 2019-12-03 08:48:00
A is a module project. There are some test targets and the relevant reusable code is compiled in a separate (static library) target. A uses the third party Lumberjack logging library. The Lumberjack code was simply dropped into the project. B is a different module project, but otherwise it has the same properties as A . C is the main project. It depends on A and B . It links the libraries of A and B . Compiling C will result in duplicate Lumberjack symbols. How can I have multiple separate module projects so that... they don't know of each other, use the same third party code, can be compiled

Library design: Hiding dependencies

£可爱£侵袭症+ 提交于 2019-12-03 08:39:14
I'm attempting to build a library that uses a third-party library internally, but I do not want to expose and of this third-party library to the user of my library. This way, when the static library is built, the user will only need my header and the compiled library. How do I deal with private members in my class definitions that are defined in the 3rd party library? For example . . header: #include "ThirdPartyLib.h" class DummyClass { TypeFromThirdParty tftp; public: bool checkStuff(const float) const; }; implementation: #include "ThirdPartyLib.h" #include "dummy.h" bool DummyClass:

Link a static library to a shared one during build?

China☆狼群 提交于 2019-12-03 08:04:25
问题 I have a problem building a shared library with GCC/Linux. Currently this shared library is created with GCC/libtool option "-shared" and everything is fine. Now there are two additional, static libraries (.a-files) that have to be added to this shared one since they provide some functionality that is required by the shared one. Adding these static libraries with option "-l" does not help, afterwards they are not part of the .so file. So how can I force GCC/libtool to really add the code of

ARC App Crashes when accessing @property form ARC static lib

谁都会走 提交于 2019-12-03 07:24:02
I have a ARC ( automatic-reference-counting ) app that builds a static library (also ARC). The app will launch fine but when the an action is performed that reads or writes to a @property in the static library the app will crash with this error: dyld: lazy symbol binding failed: Symbol not found: _objc_setProperty_nonatomic Referenced from: /var/mobile/Applications/0E7ADBB4-FFE5-4CEB-B418-8A35A92E99D4/MyApp.app/MyApp Expected in: /usr/lib/libobjc.A.dylib dyld: Symbol not found: _objc_setProperty_nonatomic Referenced from: /var/mobile/Applications/0E7ADBB4-FFE5-4CEB-B418-8A35A92E99D4/MyApp.app

How to avoid #include dependency to external library

╄→гoц情女王★ 提交于 2019-12-03 07:18:48
问题 If I'm creating a static library with a header file such as this: // Myfile.h #include "SomeHeaderFile.h" // External library Class MyClass { // My code }; Within my own project I can tell the compiler (in my case, Visual Studio) where to look for SomeHeaderFile.h. However, I don't want my users to be concerned with this - they should be able to include my header without having to inform their compiler about the location of SomeHeaderFile.h. How is this type of situation normally handled? 回答1

Localization of strings in static lib

孤者浪人 提交于 2019-12-03 07:04:46
问题 I have a project that uses a static library (SL). In that SL, there are a couple of strings I'd like to localize and the project includes all of the localization files. The localization works just fine when storing all text translations in the same file. The thing is that I'd like to separate the SL strings from the other strings. I have tried to put two different *.strings files (Localizable.strings and Localizable2.strings) in the language folder of interest but that did not work. I have