static-libraries

iOS:Unix:Mac extract info from a static lib regarding supported architecture(s). How?

痴心易碎 提交于 2019-12-06 21:40:39
I have a static library on my Mac and curious to know if the lib was built for armV7s architecture or not? Is any command/tools available to show the supported architectures in this library? Thank you, Kamran You may use otool for getting that information. From otool's manpage -L Display the names and version numbers of the shared libraries that the object file uses. As well as the shared library ID if the file is a shared library. Example > otool -L libRaptureXML_universal.a Archive : libRaptureXML_universal.a (architecture armv7) libRaptureXML_universal.a(RXMLElement.o) (architecture armv7):

dlopen a dynamic library from a static library linux C++

女生的网名这么多〃 提交于 2019-12-06 21:07:44
I've a linux application that links against a static library (.a) and that library uses the dlopen function to load dynamic libraries (.so) If I compile the static library as dynamic and link it to the application, the dlopen it will work as expected, but if I use it as described above it won't. Can't a static library uses the dlopen function to load shared libraries? Thanks. There should be no problem with what you're trying to do: app.c: #include "staticlib.h" #include "stdio.h" int main() { printf("and the magic number is: %d\n",doSomethingDynamicish()); return 0; } staticlib.h: #ifndef _

Difference between static and dynamic library in Xcode for iPhone

旧城冷巷雨未停 提交于 2019-12-06 17:04:29
问题 What is the difference between a static and dynamic library in XCode? And why doesn't Apple allow us to use dynamic libraries in our iOS applications? 回答1: While you can build dynamic libraries for Mac OS X, you cannot use them for iPhone development. A static library is merely an archive of object files that gets pulled into a program linking against it. The linker will unarchive all the archive files, and pull them in during linking along with the rest of your object files. A dynamic

Create universal framework with static library

断了今生、忘了曾经 提交于 2019-12-06 15:58:06
问题 I have created a framework which contains a static library inside: The frameworks works in device, but simulator is started giving errors. Then i try to make the universal framework using script given here: https://medium.com/@nishantnitb/writing-custom-universal-framework-in-xcode-9-and-ios-11-7a63a2ce024a Now i can able to see universal framework: But still not able to run in simulator, this framework is working in real device. It is giving error _OBJC_CLASS_$someclass", referenced from: in

What Clever Solutions are There for Including Resources in a Static Lib?

二次信任 提交于 2019-12-06 15:49:47
I have a static library Xcode 4 project that includes a home-brewed rendering engine, and I re-use this engine in multiple apps. This engine uses OpenGL ES 2.0, and by extension, shaders. As shaders got more complicated, I moved away from storing them as NSStrings in a source file, and now store them as standalone text files with the .vert and .frag extensions. This works fine for apps that include the rendering engine in their own source; the shaders are simply added to the app's "Copy Bundle Resources" build phase, and loaded at runtime into NSStrings and compiled, linked, etc. This strategy

How to convert a static library project into a dll project in VS2005

谁都会走 提交于 2019-12-06 15:39:34
When I create a project in vs2005. I can also create Win32->Win32Project. I can choose "console application" or "dll" or "static library" if I created a static library project. How can I convert it to dll project. I found in setting panel of the created project. General->Configuration Type, I can switch Static Library(.lib) to DLL However, after this setting. I does get a dll. but I do not have a lib with it. and I can not use it in other project. How to convert a static library project into a dll project in VS2005 many thanks! The way I've done this, and this may not be the "best" way, was to

Including external C library with Xcode

安稳与你 提交于 2019-12-06 15:14:42
I have a built C static library (the Antlr 3 C library). It is installed properly and works (i.e., I can run gcc -o parser lexer.c parser.c -lantlr3c just fine). In Xcode, however, I get an error. I've added -lantlr3c in the "other linker flags" build setting. ld: library not found for -lantlr3c Command /Developer/Platforms/iPhoneSimulator.platform/Developer/usr/bin/llvm-gcc-4.2 failed with exit code 1 Several other questions I've found here ( 1 , 2 , 3 , 4 ) generally have answers targeting Xcode 3. I'm using Xcode 4.1, in an iOS static library project. I'm currently building the unit test

Linking static library into R

吃可爱长大的小学妹 提交于 2019-12-06 12:33:16
I have a static library which I am trying to use inside my R package. This is only for internal use. The libq.a for now is just within ./src folder. I was trying to add the following to src/Makevars: PKG_LIBS="-l/path/to/lib/libq.a" Where /path/to/lib is an absolute path to the libq.a location (for testing purposes only). But that doesn't seem to help. Do I have to do anything else in order to load that static library? That should work -- make sure you see the library used on the final link statement when the package is built. Mind you, though, that -L is for the patch and -lq should be all.

Dynamic library image doesn't contain x86_64, i386 architectures

烂漫一生 提交于 2019-12-06 11:50:14
问题 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 Architecture Only is set to NO . So after building my binary, I'm checking supported architectures by running file myDl.dylib in Terminal myDl.dylib (for architecture armv7): Mach-O dynamically linked shared library arm myDl.dylib (for architecture arm64)

How to pass arguments to a method loaded from a static library in CPP

Deadly 提交于 2019-12-06 11:48:53
问题 I'm trying to write a program to use a static library of a C++ code into another C++ code. The first C++ code is hello.cpp : #include <iostream> #include <string.h> using namespace std; extern "C" void say_hello(const char* name) { cout << "Hello " << name << "!\n"; } int main(){ return 0; } The I made a static library from this code, hello.a , using this command: g++ -o hello.a -static -fPIC hello.cpp -ldl Here's the second C++ code to use the library, say_hello.cpp : #include <iostream>