shared-libraries

create and use shared library with qt

僤鯓⒐⒋嵵緔 提交于 2019-12-05 08:26:12
I am new to the shared library stuff, so I have question about how to create/use a shared library, I am using Qt Creator with qt 5.4.2 with Microsoft Visual C++ 11.0 Compliler. In my project, I will need to create a dll which call functions from an external library (there are .h, .lib, .dll to use from). To understand how export/import of functions from library work, I tried to create a simple library with one function and use this in another programm first. After reading different tutorials, I managed to create the library. In Qt Creator, New Project->Library(C++ Library)->Type(shared library

statically linked shared object? Or a corrupt file?

一个人想着一个人 提交于 2019-12-05 08:15:47
I have a library that I got from a proprietary source and I'm trying to link against it but I'm getting the following error libxxx.so: file not recognized: File format not recognized collect2: ld returned 1 exit status and indeed $ ldd ./libxxx.so statically linked what does that exactly mean? Never saw a statically linked .so in my life. It might be worth noting that the last version of the same software included the same .so for which ldd shows the "normal" output and that works fine. $ file ./libxxx.so ./libxxx.so: ELF 32-bit LSB shared object, Intel 80386, version 1 (SYSV), stripped but nm

Polymorphically catching an exception in a -fno-rtti shared library on Mac OS X

扶醉桌前 提交于 2019-12-05 07:49:24
I'm building a shared library with f-no-rtti . Internally, this library throws std:invalid_argument and catches std::exception , but the catch clause is never entered. The following code reproduces the problem (g++ 4.2, Mac OS X 10.6): // library.cpp: exports f(), compiled with -fno-rtti #include <stdexcept> #include <iostream> extern "C" { void f() { try { throw std::invalid_argument("std::exception handler"); } catch( std::exception& e) { std::cout << e.what() << "\n"; } catch(...) { std::cout << "... handler\n"; } } } // main.cpp: the main executable, dynamically loads the library #include

Python cannot find shared library in cron

一世执手 提交于 2019-12-05 07:32:13
My Python script runs well in the shell. However when I cron it (under my own account) it gives me the following error: /usr/local/bin/python: error while loading shared libraries: libpython2.7.so.1.0: cannot open shared object file: No such file or directory The first line of the script has: #!/usr/local/bin/python I know I have the following line in my ~/.bashrc file, which explains it works in the shell export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/usr/local/lib If I cron it using the following it also works, but it looks ugly, and I hate to apply to every cron job. 00 * * * 1-5 export LD

MADlib apt install, how to?

流过昼夜 提交于 2019-12-05 07:25:31
MADlib is the most complete, efficient (faster functions) and reliable Mathematical library for PostgreSQL... At official download no clues about Debian or UBUNTU "plug-and-play installation". Checking other fonts, the best (simplest) is an old 2013's instruction for apt-get it . ... Also some lost-script of 2014... A comment say "can download the .rpm packages and to install in Ubuntu just convert the package to .deb using Alien command it will work". Question: secure and simplest way to install MADLib? today (2017) at UBUNTU 16 LTS and PostgreSQL v9.6. Note and secondary question: Debian

C++ load shared library and extract class implementations at runtime on linux platform

随声附和 提交于 2019-12-05 06:53:28
问题 In C++, is it possible to load a shared library at execution time? I want the user to choose which shared library to be loaded at runtime, without recompiling the whole program. dlopen() is a solution for C, but my program is written is C++/Qt, and the symbol to extract are Qt-style class, is there a more "c++" way to do that. 回答1: You can do it in Qt using QLibrary in two ways. The following example calls a function from a shared library at runtime in two different ways: #include <QLibrary>

How to set RPATH and RUNPATH with GCC/LD?

China☆狼群 提交于 2019-12-05 06:36:28
I recently encountered this problem after an upgrade of the system: using the GCC -Wl,-rpath= option works differently than before. I used it to set the search paths to some shared libraries that were built in a sub-module of my project. At the time I considered it better than setting LD_LIBRARY_PATH system-wide (I didn't want to set it every time I turned on the computer). Everything worked fine, and these two approaches seemed equivalent. Now it seams that the behavior of -rpath has changed. It still works for directly dependent libraries, but not for those that link other libraries from the

Bash script to create symbolic links to shared libraries

守給你的承諾、 提交于 2019-12-05 06:12:31
I think this question is rather easy for you shell scripting monsters. I am looking for the most elegant and shortest way to create symbolic links to shared libraries for Unix by means of a bash shell script. What I need is starting out with a list of shared library files such as "libmythings.so.1.1, libotherthings.so.5.11", get the symbolic links created such as: libmythings.so -> libmythings.so.1 -> libmythings.so.1.1 libotherthings.so -> libotherthings.so.5 -> libotherthings.so.5.11 The library files are inside a directory which contains other files such as other shell scripts. EDIT : Well,

How to relink existing shared library with extra object file

巧了我就是萌 提交于 2019-12-05 05:39:53
问题 I have existing Linux shared object file (shared library) which has been stripped. I want to produce a new version of the library with some additional functions included. I had hoped that something like the following would work, but does not: ld -o newlib.so newfuncs.o --whole-archive existinglib.so I do not have the source to the existing library. I could get it but getting a full build environment with the necessary dependencies in place would be a lot of effort for what seems like a simple

Why shared libraries between microservices are bad?

北慕城南 提交于 2019-12-05 05:12:01
Sam Newman states in his book Building Microservices The evils of too much coupling between services are far worse than the problems caused by code duplication I just don't understand how the shared code between the services is evil. Does the author mean the service boundaries themselves are poorly designed if a need for a shared library emerges, or does he really mean I should duplicate the code in the case of common business logic dependency? I don't see what that solves. Let's say I have a shared library of entities common to two services. The common domain objects for two services may