shared-libraries

classes and static variables in shared libraries

雨燕双飞 提交于 2019-11-28 03:16:23
I am trying to write something in c++ with an architecture like: App --> Core (.so) <-- Plugins (.so's) for linux, mac and windows. The Core is implicitly linked to App and Plugins are explicitly linked with dlopen/LoadLibrary to App. The problem I have: static variables in Core are duplicated at run-time -- Plugins and App have different copys of them. at least on mac, when a Plugin returns a pointer to App, dynamic casting that pointer in App always result in NULL. Can anyone give me some explanations and instructions for different platforms please? I know this may seem lazy to ask them all

Can I use shared library created in C++ in a C program?

[亡魂溺海] 提交于 2019-11-28 03:12:36
I am creating programs using C. However, I require to use a lot of libraries that have API's only for C++. So, is it possible that I can create a shared object in C++ and then access its functionality using C? The only data I would be passing and returning would be C compatible data types. Converting or migrating to cpp is not an option here. If it is not possible to interface these codes, how do I get information from C++ code to C code? I tried calling C++ functions from C, but I get errors during linking when I include <string> . So when I call C++ functions from C, should I only use that

How to build and install gcc with built-in rpath?

一世执手 提交于 2019-11-28 03:12:17
问题 I'm trying to build and install my own gcc 4.7.2 in /usr/local to use in place of the gcc 4.4.6 in /usr. (This is on CentOS 6.3.) gcc makes executables and dynamic libraries that dynamically link to its own dynamic libraries, e.g. libstdc++.so. How do I build and install gcc so that the generated binaries automatically get a linker -rpath option (-rpath /usr/local/lib64) that causes dynamic libraries in /usr/local/lib64 to be linked instead of those in /usr/lib64 or /lib64? If it works

FFmpeg command for crossfading between 5 videos .How to manage setpts=PTS-STARTPTS?

怎甘沉沦 提交于 2019-11-28 02:28:18
Here, New in FFmpeg . I am using and testing in console in FFmpeg . I already done with 2 video join with cross fading with this question : I am doing for 5 videos merging with cross fade I just done 90% in merging i just need to manage setpts=PTS-STARTPTS Just look into this pls. ffmpeg -i big_buck.mp4 -i big_buck.mp4 -i big_buck.mp4 -i big_buck.mp4 -i big_buck.mp4 -filter_complex "[0:v]trim=0:4,setpts=PTS- STARTPTS,fade=out:st=4:d=1:alpha=1[1]; [1:v]trim=1:4,setpts=PTS- STARTPTS,format=yuva420p,fade=in:st=0:d=1:alpha=1,fade=out:st=4:d=1:alpha=1[2]; [2:v]trim=1:4,setpts=PTS- STARTPTS,format

PHP cannot load shared libraries

寵の児 提交于 2019-11-28 02:18:12
I'm new to posting on this forum. Hopefully I don't make any social mistakes here. I have: Linux system (64 bit) php compiled and installed with the following options: ./configure --enable-maintainer-zts --with-pdo-mysql --with-mysqli=mysqlnd --prefix=/etc/httpd/php --with-gd --with-config-file-path=/etc/httpd/php --disable-cgi --with-zlib --with-gettext --with-gdbm --enable-zip --enable-mbstring --with-zlib-dir=/usr/include --with-libxml-dir=/usr/lib64 --with-mcrypt=/usr/lib64 --with-jpeg-dir=/usr --with-png-dir=/usr --with-apxs2=/etc/httpd/bin/apxs --enable-shared php.ini with the following

MCR libmwi18n.so file missing

寵の児 提交于 2019-11-28 02:11:32
问题 I've just installed the Matlab MCR, and I tried to run a piece of code: ./run_test.sh /usr/local/MATLAB/MATLAB_Compiler_Runtime/ And I get this error in return: LD_LIBRARY_PATH is .:/usr/local/MATLAB/MATLAB_Compiler_Runtime//runtime/glnxa64:/usr/local/MATLAB/MATLAB_Compiler_Runtime//bin/glnxa64:/usr/local/MATLAB/MATLAB_Compiler_Runtime//sys/os/glnxa64:/usr/local/MATLAB/MATLAB_Compiler_Runtime//sys/java/jre/glnxa64/jre/lib/amd64/native_threads:/usr/local/MATLAB/MATLAB_Compiler_Runtime//sys

makefile for creating (.so) file from existing files

淺唱寂寞╮ 提交于 2019-11-28 01:50:22
问题 I have 4 files: 1.c , 1.h , 2.c , 2.h . I need a makefile, which will create a dynamic library (.so) from those 4 files. I have tried to write a makefile like this: library.so : 1.c 1.h 2.c 2.h but it did not work. It would be great, if someone helps me, thanks. 回答1: Something like CC=gcc CFLAGS= -Wall -g -O -fPIC RM= rm -f .PHONY: all clean all: library.so clean: $(RM) *.o *.so library.so: 1.o 2.o $(LINK.c) -shared $< -o $@ 1.o: 1.c 1.h 2.h 2.o: 2.c 1.h 2.h But this is untested! I am

Shared object in Linux without symbol interposition, -fno-semantic-interposition error

一曲冷凌霜 提交于 2019-11-28 01:37:21
问题 Shared objects (*.so) in Unix-like systems are inefficient because of the symbol interposition: Every access to a global variable inside the .so needs a GOT lookup, and every call from one function to another inside the .so needs a PLT lookup. I was therefore happy to see that gcc version 5.1 has added the option -fno-semantic-interposition. However, when I try to make a .so where one function calls another without using a PLT, I get the error message: relocation R_X86_64_PC32 against symbol

dlopen - Undefined symbol error

折月煮酒 提交于 2019-11-28 00:38:27
问题 I'm using dlopen to load a shared library at run time dlopen("SharedLibarary1.so", RTLD_NOW | RTLD_GLOBAL); In that shared object I refer to a const char* defined in another shared library "SharedLibarary2.so". The Executable, and both the libraries are built using -rdynamic. But I still get the run time error when using dlopen: "/usr/lib/SharedLibarary1.so: undefined symbol" and points to the mangled const char* has the undefined symbol. Whith GDB "info share" I can see that the second

libpython2.7.so.1.0: cannot open shared object file: No such file or directory

自闭症网瘾萝莉.ら 提交于 2019-11-27 23:28:08
I have trying to run python script from the terminal but getting the next error message : ImportError: libpython2.7.so.1.0: cannot open shared object file: No such file or directory if I run print sys.version I get : >>> import sys >>> print sys.version 2.7.3 (default, Feb 26 2013, 16:27:39) [GCC 4.4.6 20120305 (Red Hat 4.4.6-4)] and if I run ldd /usr/local/bin/python >> ldd /usr/local/bin/python linux-vdso.so.1 => (0x00007fff219ff000) libpthread.so.0 => /lib64/libpthread.so.0 (0x0000003300c00000) libdl.so.2 => /lib64/libdl.so.2 (0x0000003300800000) libutil.so.1 => /lib64/libutil.so.1