static-linking

How to statically link an existing linux executable?

Looking for a way to convert a dynamically linked executable to a static executable. Seems like it should be possible but man pages are turning up short and google's not helping either. ...

Static Libraries on iPhone device

I have two projects, a Cocoa iPhone application and a static library which it uses. I've tested it successfully on the iPhone simulator, but when I try to deploy it to my iPhone device I get (symbol not found) link errors. If I remove the dependancy of the library the project builds/runs fine. I have made sure all the build settings a...

How to link a .DLL statically?

We have a (pure native C++) .DLL that is build by VS. As clients we have some native C++ applications and a .Net-Wrapper around this DLL written in C++/CLI. Finally there are some client applications for the .Net-Wrapper written in C#. My problem is that the native.dll must be distributed in a different way than the .Net world works and...

Proper way to link against libraries from libraries for the iPhone/CocoaTouch

I'm writing a static library for the iPhone and I'm wondering if what I'm doing is recommended or if I should take a different approach. The static library I'm writing is dependant on libxml2. libxml2 has a dynamic library (dylib) and a static library (a). I've tried two approaches. Approach one - When I attempt to link against the s...

Why do I need an *.obj file when statically linking?

I'm not sure why is this. I'm distributing a static *.lib across multiple projects, but this static lib generates many *.obj files. Seems like I need to distribute also those *.obj files with the *.lib. Otherwise, I get this error: 1>LINK : fatal error LNK1181: cannot open input file 'nsglCore.obj' Why is this? Is there a way to inclu...

eliminating the inter-compiler incompatibility issue with C++ dynamic libraries

..., a follow up to this. From the answers I've been given to my referenced question I've learned that: different compilers use different name decoration, which makes it impossible to use a C++ dynamic library built with compiler A in a project built with compiler B, the library can be built as static saving me including n header and ...

Do I need static libraries to statically link?

On 'C', Linux, Do I need static libraries to statically link, or the shared ones I have suffice? If not, why not? (Don't they contain the same data?) ...

C-library not linking using gcc/g++

I have a c-library which I use in gcc. The library has the extension .lib but is always linked as a static library. If i write a program which uses the library as c-code, everything as a-ok. If I however rename the file to .cpp (doing simple stuff that works in both c/c++) I get undefined reference. These are simple small programs I writ...

How does function-level linking deal with variables declared at file level?

As I understand function-level linking builds (explicitly or not) a graph of all possible calls and only includes the reachable functions' code into the produced binary. But how does it deal with variables declared at file level? Say I have MyClass GlobalVariable; static MyClass StaticGlobalVariable; in some file that contains only t...

Statically and dynamically linking the same library

I have a program that's statically linking to a library (libA.2.0.a) and also dynamically links to another library (libB.so). libB.so also dynamically links to an older version of libA (libA.1.0.so). Is this configuration possible? And if so, how does the system know to use the symbols from libA.2.0.a for my program and the symbols from...

How to get rid of warning LNK4006 when not using templates?

I know the question is not very descriptive but I couldn't phrase it better. I'm trying to compile a static linked library that has several objects, all the objects contain the following: #include foo.h foo.h is something along these lines: #pragma once template<class T> class DataT{ private: T m_v; public: D...

Is there a way to determine which version of Visual Studio was used to compile a static library?

I have a collection of static libraries (.lib) files one of which may have been built with a different version of Visual Studio. This is causing the code generation of a project that links against all of them to fail. Is there any way to determine which version of Visual Studio was used to compile a static library? ...

Visual Studio 2008 IDE - Static Linking a C Dll Library

I am experiencing Frustration ^ Frustraion with this %&$^& VS IDE. I am using Visual C++ 2008 3.5 SP1 (but I also have the pro edition if that is needed and I dont want to use loadlibrary()) I have a test Dll created in another language (basic not C in fact) that contains a CDECL function that adds an 'int' to a 'double'. I would really...

How do I use Ruby 1.9 with Managed C++?

I'm trying to create a dot net library to use ruby, for the sake of this, I'm linking ruby's static library but I'm getting some LNK error. I'm using Visual Studio 2008, thanks in advance. ...

Static library for DevIL?

Hi, I really need a static version of the DevIL DLLs for windows as I need to statically link my program to it. Anyone got one? I, unfortunately, don't have the toolchain to compile from source :/ thanks, ...

How can I find out what makes my application mix the statically and dynamically linked CRT

...

#pragma comment(lib, "xxx.lib") equivalent under Linux?

I have a static library file called libunp.a, I do know I could use gcc -lunp xx to link to the library. I could use #pragma comment(lib,"xxx.lib") to tell the microsoft c/c++ compiler to include the library,how could I do it under linux/gcc? thanks. ...

How to statically link libevent with gcc while compiling?

I have used event.h in on of my project but the server it has to run on does not support it. Moreover I can not install it also. Is there a way I can run my project with minimum modifications. It has to be compiled statically linked in but how do I do that? ...

How to link different precompiled libraries for different build profiles in XCode for iPhone?

My client is providing me with two precompiled libraries, blah-device.a and blah-simulator.a. How do I tell xcode to use blah-device.a in Device compilation mode and simulator in Simulator compilation mode? My client gives me these instructions Open the Targets group (in the Groups & Files panel), right-click the project icon,...

Linking loadable plugins against symbols in the executable on Linux and Windows

It's very on the Mac to create a loadable plugin as a bundle and make it use symbols in the Host executable. How can this be done on Linux and Windows? I hear there's -rdynamic on Linux that may come in handy but I'm completely at a loss as far as Windows goes. The point is to move away from linking both the host and the plugin against...