Questions tagged [static-libraries]

A static library is an archive of object files. Used as a linker input, the linker extracts the object files it needs to carry on the linkage.

static-libraries
Filter by
Sorted by
Tagged with
136 votes
4 answers
56k views

"Do Not Embed", "Embed & Sign", "Embed Without Signing". What are they?. What they do?

We have 3 new options in "Frameworks, Libraries, and Embedded Content" section of Xcode11 Beta for adding libraries. Xcode Libraries section screenshot Can anyone explain what they do?
1 vote
0 answers
96 views

Do Dynamic Libraries (*.so) always result in a smaller binary?

I've been experimenting with static and dynamic libraries using GCC on GNU/Linux. My understanding is that static libraries are directly inserted into the executable, while dynamic libraries remain ...
6 votes
2 answers
9k views

Exporting symbols in static library that is linked to dynamic library

I have the following scenario in MSVC2017: A static library with the function bool foo() A dynamic link library that links to the static library above An application that loads the dynamic link ...
1 vote
0 answers
151 views

Is there a way to add source information in static libraries similar to what can be done with .pdb?

If I build a dll or an exe file it is possible to embed source information into the corresponding pdb using pdpstr.exe and a source server data block: SRCSRV: ini --------------------------------------...
0 votes
1 answer
230 views

Is this a bug with Meson using static libs on Mac

Using meson 0.64.1 on a Mac, having problem using static libs installed by Homebrew. This line - iconv_lib_dep = c_compiler.find_library('iconv', dirs: cross_lib_path, static: true) gives "ERROR:...
0 votes
1 answer
475 views

How to bundle a static library with an import library (or two static libraries) with lib.exe?

Import libraries for DLLs on Windows are a peculiar thing. They donate the glue necessary for the linker to create import stubs in the resulting PE file (be it named .dll or .exe or whatever else). ...
6 votes
2 answers
4k views

framework in ios contain static or dynamic library inside

I have come across multiple sites describing that frameworks can contain both static as well as dynamic library. But how do I identify if what the framework actually contains is a dynamic library or a ...
0 votes
1 answer
332 views

Is it possible to link Linux static C++ library at runtime?

I know that the question is strange because we all know that a static .a library can be linked only at compile time. I have a confidential code that I cannot share, but my question is what can let a ...
0 votes
0 answers
790 views

How to Use static libraries in Flutter iOS?

I'm trying to add a static library to my Flutter project, it doesn't matter whether it's a plugin or a script, as long as it can be referenced as a module in AppDelegate.swift. I have tried adding a ...
0 votes
1 answer
52 views

C# Path to linked library / FileVersionInfo of DLL

I am currently working on a C# project in which I load libraries using Kernel32->LoadLibrary() and also integrate (statically linked ???) libraries in VS 2022 17.1.1. Now I read information about ...
3 votes
3 answers
5k views

How can I force MSVC++ to ignore CRT dependencies of a static library?

I don't know if it's possible to do this, but I would like the /NODEFAULTLIB to be applied to a static library project. I have many application projects (A.exe, B.dll, C.dll) that use a common static ...
1 vote
1 answer
354 views

Same function name in a shared library and a static library that a project link to

I am building my project in C++. I have these two libraries: shared_lib1 and static_lib2. Both have a function with the same name as func(). Only func() in static_lib2 has an assert statement. ...
2 votes
1 answer
219 views

Linux C++ linking with two versions of static libraries

I'm building a python extension library. Unfortunately, I'm forced to use different versions of a static library (libtiff). To avoid binding conflicts, I separated all calls to different versions of ...
0 votes
1 answer
467 views

Why does CMake fail to link my static library?

I am trying to link a static library which I have compiled from the assimp source to my executable CMake project so that it does not have to compile assimp as often since it's such a large library. I ...
1 vote
0 answers
214 views

Cmake Swift framework with C files - setting target membership and properties

I am trying to build a framework with a combination of swift and C files and using cmake to generate the XCode Project: After generating the project using this command: add_library(MyLibrary STATIC ${...
10 votes
1 answer
5k views

Why does CMake EXPORT require static libraries used to build a shared library?

I'm attempting to make it easier for other projects to link against the shared libraries we distribute with our project. When I try to take advantage of the EXPORT mechanism, CMake complains that I'm ...
1 vote
0 answers
116 views

How to force a static library at a specific memory address

I am building some applications that use a static library and I would want to force linker to put .text and .data sections of the static library (.a file) at specific addresses using GNU linker but I ...
1 vote
3 answers
2k views

Using readline statically in C (compilation and linkage)

I would like to link readline statically with my program and I found this page about readline compilation from source http://www.bioinf.org.uk/software/profit/doc/node17.html but I'm a bit confused ...
7 votes
3 answers
3k views

How do I share my C/C++ project and hide some of the source code?

I want to share my project which was written in C/C++ (Linux environment gcc/g++ compiler) as shared library/static library without actually sharing the source code. So that other users can use my ...
283 votes
27 answers
179k views

Can't use Swift classes inside Objective-C

I try to integrate Swift code in my app.My app is written in Objective-C and I added a Swift class. I've done everything described here. But my problem is that Xcode haven't created the -Swift.h file, ...
0 votes
0 answers
275 views

When building a C++ static library what causes third party libraries hidden in source files to become end user dependencies?

Sorry if this question is a bit long winded. I know there is a lot of ground already covered here. Essentially I get the below error when including my tst_engine.lib in another target. lld-link: error:...
6 votes
1 answer
2k views

MediaPipe library build on macOS

I'm trying to build MediaPipe as library on macOS to be able to use it in a desktop project with CMake, but I'm running into issues. I'm trying to convert the Hello World example to a library, using ...
0 votes
0 answers
175 views

how to static add openssl with c++ builder?

I am able to use openssl in the source code below, but without the libeay32.dll file, my project does not open. I want to add it static and eliminate the need for dlls. How can I do that ? //----------...
1 vote
1 answer
462 views

Is it possible provide relative path to __FILE__ macro if static library is build with GCC and CMake?

I am working on integrating a few static libraries in one application. All libraries are build with GCC and CMake. Unfortunately CMake provide absolute paths to compilation command, what cause macro ...
0 votes
2 answers
774 views

How to create static C++ library with multiple headers, source files...?

I'm trying to create a static library that will need many different classes. Each class has its own header and source file. I've read lots of online tutorials about making a static library, but they ...
-1 votes
1 answer
189 views

How to output a static library for iOS project from a Swift package?

I have a swift package that I want to integrate into my CI and create a static library from it. This is how the Package.Swift looks like: import PackageDescription let package = Package( name: &...
0 votes
1 answer
53 views

How to make static libraries with Makefile?

This is the Makefile CC=gcc CFLAGS=-Wall -pedantic -Werror -g LDFLAGS=-lm RM=rm -f SOURCES=$(wildcard *.c) TARGETS=$(SOURCES:.c=) OBJECTS=$(SOURCES:.c=.o) .PHONY: all clean all: test_stack %: %.c ...
1 vote
1 answer
576 views

Why is the executable size the same when linking shared vs static library?

So, I was studying about static library vs shared library and came to know that an executable linked with static library is bigger in size because static library actually becomes part of the ...
0 votes
1 answer
65 views

Custom library compiles fine, but fails with undefined refences when linked against

I'm currently building a library using cmake and crypto++. While the library compiles just fine the code referencing it does not. cmake for library: add_library(MYCrypto Crypto.cpp) ...
1 vote
1 answer
88 views

Error while trying to link a static C library to golang code using cgo package - skipping incompatible ./addLogic.lib when searching for -laddLogic

I am trying to use a C static library file in a golang code using cgo module. I am working on a project in which I had to use C code with golang, so the solution was to use the cgo module. However, I ...
-2 votes
1 answer
792 views

Writing the header file of my own library

I write some functions to use dinamic arrays in c, without the problem of pointers ecc. , and now that i write enough code to use it properly, i want to encapsulate all this functions in a library. ...
3 votes
0 answers
94 views

Why removing orphan functions will not help size of my statically linked file [duplicate]

Let's consider this minimal example: main.c #include <stdio.h> int main() { printf("Hello World\n"); return 0; } and I compile it dynamically linked: gcc main.c -o dl_out ...
0 votes
1 answer
537 views

How to include asio boost in cmake project

I'm trying to include asio boost using CMakein my project but I'm getting this error. libraries linking is working in VS but I don't know how to link them in Cmake project. Working Solution with VS:- ...
0 votes
1 answer
158 views

How do i resolve this error I am trying to compile some functions and create a static library but I am getting this error

/usr/bin/ld: /usr/lib/gcc/x86_64-linux-gnu/9/../../../x86_64-linux-gnu/Scrt1.0: in function '_start' : (.text+0x24): undefined reference to 'main' Collect2: error: ld returned to 1 exit status
2 votes
2 answers
503 views

tensorflow C API static library

Can I build/get static library (.a files instead of .so files) of tensorflow C API? I need to include/link tensorflow c api in my C++ software xyz and then I build shared library xyz.so that will be ...
0 votes
1 answer
1k views

Has anyone experience in building a static library for the Tensorflow C++ API?

I need to build Tensorflow as a static library to include into a product. As of now it seems that there's only support for building a shared/dynamic library with bazel. My current objective is to ...
36 votes
3 answers
129k views

CMake and Static Linking

I'm using CMake in a project, and I'm trying to statically link some libraries. I've set: set(BUILD_SHARED_LIBS OFF) set(CMAKE_EXE_LINKER_FLAGS "-static-libgcc -static-libstdc++ -static") ...
289 votes
2 answers
170k views

What's the difference between .so, .la and .a library files?

I know an .so file is a kind of dynamic library (lots of threads can share such libraries so there is no need to have more than one copy of it in memory). But what is the difference between .a and .la?...
1 vote
2 answers
2k views

Distributing Windows C++ library: how to decide whether to create static or dynamic library?

We have been converting our Java and .NET API library to C++, and are trying to figure out what is the best way to distribute a compiled version to other developers to use with their custom ...
0 votes
1 answer
477 views

Using g++ to link a static library

I have a Makefile setup to build unit tests for my application: test: app_test.o sdk.o g++ -L/usr/lib/x86_64-linux-gnu/ --coverage -o test app_test.o sdk.o ./sdk/libNSomeLib.so.2.6 -...
0 votes
1 answer
78 views

Creating alternative C API for existing library

Is it considered a bad practice to expose different type names in API and not use types from the library itself? If there is a library like this: struct Internal { int first; float second; }; ...
0 votes
1 answer
63 views

“llvm-config --libs all” return differently in apt package and Self-compiled. What is the library structure of LLVM?

# Self-compiled shared library DESKTOP-BMR5HSI:/usr/local/llvm/bin$ ./llvm-config --libs all -lLLVMWindowsManifest -lLLVMXRay -lLLVMLibDriver -lLLVMDlltoolDriver -lLLVMCoverage -lLLVMLineEditor -...
0 votes
1 answer
853 views

How to add shared or static library using PyTorch C++ extension?

How do I use torch.utils.cpp_extension.load to link shared or static library from external source? I wrote some function in C++, and am using it in PyTorch. So I am using load function from torch....
0 votes
0 answers
552 views

X11 not being linked into static library

So I am building a tiny "game engine" in C++, using cmake to build it, and I am making it as a static library. In windows it works perfectly, but in linux I need to link X11. Now this wouldn'...
3 votes
1 answer
9k views

Xcode: use a static library in a framework?

I have a framework that links against two static libraries. Each static library is a target and the framework is a target. The framework wraps the static libraries and clients of the framework only ...
0 votes
0 answers
339 views

Convert a shared lib to a static one (again)

I have done a bit of research and I saw several answers here on SO, including this and this. I do understand the process of creating a Shared Object actually merges all the various sources and ...
0 votes
1 answer
96 views

How to properly setup a "library-chain" in visual studio?

I am having problem setting up the library configuration for my executable project in visual studio 2022. In my solution I have this three following projects: Common (lib) Render (lib) Game (...
45 votes
2 answers
25k views

How to build an Objective-C static library? [closed]

I have some Objective-C classes, which I am currently using in both a Cocoa application (Mac OS X) and a Cocoa-Touch application (iOS). Currently, when I update those classes, I have to copy those ...
2 votes
1 answer
8k views

How to debug code of static library (libeay32.lib and ssleay32.lib)

I have built openssl static libraries(libeay32.lib and ssleay32.lib) with openssl source code using VC++ compiler. I use them in a VS2010 project and they works well. #pragma comment( lib, "libeay32....

1
3 4
5
6 7
91