static-libraries

Weak-linking with static libraries

I have declared an external function with a GCC weak attribute in a .c file: extern int weakFunction( ) __attribute__ ((weak)); Compiled object file has weakFunction defined as a weak symbol. Output of nm: 1791: w weakFunction I am calling the weak defined function as follows: if (weakFunction != NULL) { weakFunction()...

Extraneous Library Linkage

I have a question which may be somewhat silly because I'm pretty sure I may know the answer already. Suppose you have static library A, and dynamic shared object library B and your program C under linux. Suppose that library A calls functions from library B and your program calls functions from library A. Now suppose that all functions ...

linkning linux static libraries in windows with cygwin

I'm having a binary static library libfoo.a compiled for 32 bit linux machine. I wish to compile it against my win32 project compiled with cygwin. Is that possible? It seems to be possible, as all the object files in the archive should be in the standard ELF format. However I keep recieving linking errors about functions that nm finds ...

Ideas for a C/C++ library

I thought one of the best ways to familiarise myself with C/C++, is to make a helpful library. I was maybe thinking like a geometry library, like to calculate areas, surface area, etc. It would be useful in game programming. Or maybe an algebra library, like for different formulas like the distance formula, quadratic formula, etc. Or may...

Difference between static and shared library in C

What is the difference??? I use Eclipse and there are several project types including Static Libraries and Shared Libraries? Does one have an advantage over the other? ...

How to use functions in a .a (static library) file in C?

I have a static library project in Eclipse that was compiled into a .a file. So now how would I use the functions and constants in that library? Would I just put in into my includes: #include "mylib.a" ...

Re-usable Obj-C classes with custom values: The right way

I'm trying to reuse a group of Obj-C clases between iPhone applications. The values that differ from app to app have been isolated and I'm trying to figure out the best way to apply these custom values to the classes on an app-to-app basis. Should I hold them in code? // I might have 10 customizable values for each class, that's a lon...

How do I create both a .lib file and an .exe file in Visual C++?

I currently have a console project which creates an .exe file; I want it to also create a .lib file so other projects, compiled as DLLs, would be able to call functions from the original project. I know it is possible, but I couldn't find how to do that. How do I tell the linker to also link a .lib? ...

Exposing headers on iPhone static library

Hello guys, I've followed this tutorial for setting up a static library with common classes from 3 projects we are working on. It's pretty simple, create a new static library project on xcode, add the code there, a change some headers role from project to public. The tutorial says I should add my library folder to the header search pat...

Size of static libraries generated by Xcode

I have a project tree in Xcode that looks like this: AppProject depends on ObjcWrapper which in turn depends on PureCppLib. ObjcWrapper and PureCppLib are static library projects. Combined, all sources barely reach 15k lines of code, and, as expected, the size of resulting binary is about 750Kb in release mode and slightly over 1Mb in de...

Using Unit Tests While Developing Static Libraries in Obj-C

I'm developing a static library in Obj-C for a CocoaTouch project. I've added unit testing to my Xcode project by using the built in OCUnit framework. I can run tests successfully upon building the project and everything looks good. However I'm a little confused about something. Part of what the static library does is to connect to a UR...

Function names extraction from static library.

Hi! I have a static library static_library.a How to list functions and methods realized there. or at least how to look is there concrete function 'FUNCTION_NAME' realized? ...

How to use the debugger with nested static libraries in XCode?

Hi all, A project that I've inherited has the following structure: Project A produces a static library. Project B produces a static library and links with library A. Project C produces the executable and links with library B. When I run app in debug mode, I can successfully debug code within the executable (project C) and the static...

Creating a C++ static lib to use with Java on Android

I have some C++ code that I want to make into a static lib for use with Java on the Android platform. Can anyone point me to a resource that tells me how to do this? I am completely new to Java and Android. ...

Calls to singleton library

I have a singleton class, and I will compile it as a library static(lib) or dynamic(dll). Is it guaranteed that calls to same file in a machine always refer to same and unique instance in both cases? Edit: What if a process loads two different library and different functions from these libraries want to use instance of singleton class....

How to build gnu `libiconv` on & for windows?

Hello, I want to build a static library (*.LIB file) GNU libiconv on windows to be used with other libraries in Visual C++. Other libraries I'm using are built with "MultiThreaded DLL" (/MD) Runtime option. So, I need to build libiconv with the same option. Problem is the libiconv uses GNU build system and I want to compile with /MD op...

Howto compile a static library in linux

Hi folks: I have a question: How to compile a static library in linux with gcc, i.e. I need to compile my source code into a file named out.a. Is it sufficient to simply compile with the command gcc -o out.a out.c? I'm not quite familiar with gcc, hope anyone can give me a hand. Thanks Regards. ...

How to deal with recursive dependencies between static libraries using the binutils linker?

I'm porting an existing system from Windows to Linux. The build is structured with multiple static libraries. I ran into a linking error where a symbol (defined in libA) could not be found in an object from libB. The linker line looked like g++ test_obj.o -lA -lB -o test The problem of course being that by the time the linker finds it ...

Visual Studio 2010 library linking order

How do you specify, in Visual Studio 2010, the order in which library files should be linked? I have a project that links against libexpat and against another library. This library (not under my control) seems to also include libexpat. The problem is that 'we' use a different version of the library (XML_UNICODE vs not). In Visual Studio...

How do i compile a static library (fat) for armv6, armv7 and i386

I know this question has been posed several times, but my goal is slightly different with regard to what I have found searching the web. Specifically, I am already able to build a static library for iPhone, but the final fat file I am able to build only contains arm and i386 architectures (and I am not sure to what arm refers: is v6 or v...