static-libraries

Export an `OBJC_CLASS` from one static lib as part of another

走远了吗. 提交于 2019-12-22 10:44:43
问题 I want to create a static library (actually, a framework, but I know how to do that part) that bundles up code from, among other things, another static library. However, the OBJC_CLASS exports from the original library end up as undefined symbols. For example, in Xcode 5.1.1 (using default settings/choices at every step, unless otherwise specified): Create a new "iOS Framework & Library Cocoa Touch Static Library" project named LibA. Build (for either simulator or a real device, doesn't

Static library and internationalization

ε祈祈猫儿з 提交于 2019-12-22 09:45:38
问题 I have a question regarding static libraries. I need to localize some text inside my library. So I created a bundle where I put my different localized files. Then, I created a function like this : NSString *MyLocalizedString(NSString* key, NSString* comment) { static NSBundle* bundle = nil; if (!bundle) { NSString* path = [[[NSBundle mainBundle] resourcePath] stringByAppendingPathComponent:@"MyStaticLib.bundle"]; bundle = [[NSBundle bundleWithPath:path] retain]; } return [bundle

C++ static class member not initialized in a * static library *

↘锁芯ラ 提交于 2019-12-22 08:47:43
问题 I'm currently facing an annoying issue with C++. Actually, I don't even understand why I didn't face it for the past 20 years :( In my current context, we heavily use c++ executables (mostly in Linux embedded systems) statically linked with our proprietary static libs. And we do use static libs for technical and optimization reasons. Over the past years, indeed, I used to create shared libs though... So I began to write some classes with static class members. Such as follow: class Inner {

When is a header file required for using a static library?

戏子无情 提交于 2019-12-22 06:30:10
问题 If I create a static library in C++ in Linux such that a ".a" file is produced, how do I (or anyone else) use the library? For example, my library defines a class. I assume that it is not sufficient merely to provide the ".a" file, but also to provide a header file. How do I know what header files must be provided with the ".a" file? For example, do I need to provide all header files that were included anywhere in the code for my library? 回答1: The technical reason for header files is to let

Linking FFTW into an Android NDK application

落爺英雄遲暮 提交于 2019-12-22 06:02:37
问题 I am currently writing a genre classification application as my final year project in Computer Engineering. I initially wrote the feature extraction code (implementing FFTW) in C and now I need to implement it on Android via the NDK. This is my first NDK project so I'm still getting the hang of things but I have compiled the FFTW3 library for Android according to this guide. I didn't do the very last step because I didn't think it was right for what I need. My question is how do I, after the

Xcode 11 not recognizing static library's architecture: MacCatalyst (aka UIKitForMac)

帅比萌擦擦* 提交于 2019-12-22 04:49:06
问题 After getting excited about 2019's WWDC announcements, I tried compiling my existing iOS app against the MacOS using Xcode 11.0 beta. Unfortunately, it didn't go as expected. Xcode says my static library is built for < unknown > architecture: Building for UIKit for Mac, but the linked library 'libssl.a' was built for < unknown >. You may need to restrict the platforms for which this library should be linked in the target editor. But when I check my static libs, I can see they do contain the

Static library (.lib) to Python project

人走茶凉 提交于 2019-12-22 04:42:10
问题 is it possible to import modules from .lib library to Python program (as simple as .dll)? 回答1: In theory, yes; in practice, probably not -- and certainly not as simply as a DLL. Static libraries are essentially just collections of object files, and need a full linker to correctly resolve all relocation references they may contain. It might be possible to take your static library and simply link its contents to form a shared library, but that would require that the static library had been

I cannot build python.dll as a static library (/MTd) using Visual Studio

杀马特。学长 韩版系。学妹 提交于 2019-12-22 00:16:09
问题 I am working with the 3.6.4 source release of Python. I have no trouble building it with Visual Studio as a dynamic library (/MDd) I can link the Python .dll to my own code and verify its operation. But when I build it (and my code) with (/MTd) it soon runs off the rails when I try to open a file with a Python program. A Debug assertion fails in read.cpp ("Expression: _osfile(fh) & FOPEN"). What I believe is happening is the Python .dll is linking with improper system libraries. What I can't

Linking with static library not equivalent to linking with its objects

孤人 提交于 2019-12-21 20:36:05
问题 Problem: The firmware image generated when linking with a static library is different to the firmware image generated when linking with the objects directly extracted from the static library. Both firmware images link without error and load successfully onto the microcontroller. The latter binary (linked with objects) executes successfully and as expected, while the former (linked to the static library) does not. The only warnings during compilation are unused-but-set-variable in the

Create a C wrapper around a C++ library that can be linked by a C linker

五迷三道 提交于 2019-12-21 19:56:18
问题 Following the answer given to this question (Developing C wrapper API for Object-Oriented C++ code) I managed to write a C wrapper for my C++ code. I would like to compile and link my wrapper into a static library (compiled using g++) that could be used, compiled and linked using gcc only (not g++). This way the user of the library would not have to care that the library is written in C++. Is this something possible? 回答1: This link explains some of the compiler options and scenarios: http:/