Questions tagged [shared-libraries]

Shared libraries are libraries that are loaded by programs when they start. A single shared copy of each library is loaded into physical memory and may be used by multiple processes at the same time. This reduces memory use and improves system performance. This tag should never be used alone.

7905 questions
3
votes
1 answer

How to keep `LD_LIBRARY_PATH` from getting overwritten to pwd when running python script

I have a python script which eventually calls a binary that requires certain shared libraries. However, I have been running into the following error: error while loading shared libraries: libmkl_rt.so: cannot open shared object file: No such file or…
3
votes
1 answer

How does linker resolve references to data object in shared libraries at link time?

I am learning about linking and found a small question that I could not understand. Consider the following files: main.c #include "other.h" extern int i; int main() { ++i; inci(); return 0; } other.c int i = 0; void inci() { ++i; } Then I…
drcxd
  • 65
  • 4
3
votes
0 answers

Published styled-components UI library does not have access to extended theme types on the consumer side

I am creating UI library using styled-components. I am extending the DefaultTheme type to support custom themes that are needed for our use case. Both theme and theme definition is coming from a different internal package that I use. When working on…
3
votes
1 answer

How can I create a shared library using C++20 modules and use it in a different project in the same solution?

I have a solution called Almond which contains two projects: Almond Sandbox Almond is a shared library created using C++20 modules. Sandbox is supposed to be an executable that links to Almond at runtime (also configured for C++20). I added almond…
NaniNoni
  • 155
  • 11
3
votes
0 answers

symbol visibility for member functions of explicit specializations

I'm building an extensible "type system" in C++ that, amongst other things, needs to map C++ float types to my "wobbly types". The mechanism I've devised for this is to construct a helper struct, templated by the concrete C++ type, that has a single…
SamM
  • 155
  • 1
  • 6
3
votes
0 answers

GO: How to share code between multiple apps in the same repository

I'm new to Golang. I have multiple apps residing in the same folder in a mono repository. apps app1 go.mod go.sum main.go app2 go.mod go.sum main.go app3 go.mod go.sum main.go There is…
user246392
  • 2,661
  • 11
  • 54
  • 96
3
votes
1 answer

Different version require of CMake results dlopen "undefined symbol"

I'm building with g++/KDevelop/CMake(3.16.3). Before I put cmake_minimum_required( VERSION 3.0.0 ) in the first line of my CMakeLists.txt and everythings OK, now I need change it to cmake_minimum_required( VERSION 3.4.0 ) because of other…
Leon
  • 1,489
  • 1
  • 12
  • 31
3
votes
1 answer

Why is .rela.plt necessary for resolving PIC function addresses?

While exploring ELF structure, I see this (this is objdump -d and readelf -r of the binary linked with a PIC .so containing ml_func): 0000000000400480 <_Z7ml_funcii@plt>: 400480: ff 25 92 0b 20 00 jmpq *0x200b92(%rip) # 601018…
deshalder
  • 507
  • 2
  • 13
3
votes
3 answers

PHP isn't linking MySQL shared library correctly on build

I'm trying to build PHP on my new computer with this configuration: export MACOSX_DEPLOYMENT_TARGET=10.7 CFLAGS="-arch x86_64" CXXFLAGS="-arch x86_64" LIBS=-lresolv export DYLD_LIBRARY_PATH=/usr/local/mysql/lib ./configure --prefix=/usr/local…
Matt Diamond
  • 11,646
  • 5
  • 29
  • 36
3
votes
1 answer

PhpStorm: Missing code completion on custom Vue 3 component library

I have built a Vue Component Library for my projects. After I have integrated the library in my main.js with app.use(ComponentLibrary), and use the individual components in my views, they do not have code-completion or tag & attribute suggestions in…
Josh
  • 294
  • 1
  • 2
  • 11
3
votes
3 answers

How to set LD_PRELOAD in systemd

I want to hook some functions in libssl with LD_PRELOAD in systemd. In systemd file I put ExecStart=/etc/myscript.sh and in /etc/myscript.sh I put #!/bin/sh LD_PRELOAD=/lib/inject_libssl.so /bin/run When I look at /proc/RUN_PID/maps I can see that…
Kokomelom
  • 143
  • 1
  • 10
3
votes
0 answers

Is it possible to define a symbol dynamically such that it will be found by dlsym?

I want to simulate loading symbols from a shared library for testing purposes. Is there a way to define a symbol at runtime programmatically such that dlsym will find it? For example: dl_define_symbol("foobar") .... void* f =…
Bruce Adams
  • 4,953
  • 4
  • 48
  • 111
3
votes
3 answers

R fails to load igraph in conda environment

I am trying to run an RShiny app in a WSL2 installation of Ubuntu on Windows. I am no expert in R, but I feel this is a problem due to conda interaction with R. I run the following commands: conda create -n r_env r-essentials r-base conda activate…
3
votes
2 answers

Where to find the perl shared objects directory?

I just purchased a commercial perl shared object that is really light on its documentation. Specifically it's an ".so" file and I know that it needs to go into whatever directory perl is using to find shared objects. Normally I encounter ".pm" files…
Jane Wilkie
  • 1,703
  • 3
  • 25
  • 49
3
votes
1 answer

Initialization and finalization of pybind module

I am wrapping some c++ library code to create a pybind11 module. I adopt the approach described here: https://github.com/pybind/cmake_example After building the library, it will be imported in Python using something like: import cmake_example as…
willem
  • 2,617
  • 5
  • 26
  • 38