shared-libraries

CMake - Only link a library to an executable if it is needed

岁酱吖の 提交于 2019-12-26 03:53:12
问题 I have a project that includes several source files, and I am using the GoogleTest library to create unit tests for some of these source files. The tests are all separate .cpp files and each includes the header of the respective source file to be tested. I want to create a separate executable for each unit test. To do this I have a loop that creates an executable for each member in a test_sources list, and names it according to a test_names list. The problem is that a couple of my unit tests

CMake - Only link a library to an executable if it is needed

不羁岁月 提交于 2019-12-26 03:53:04
问题 I have a project that includes several source files, and I am using the GoogleTest library to create unit tests for some of these source files. The tests are all separate .cpp files and each includes the header of the respective source file to be tested. I want to create a separate executable for each unit test. To do this I have a loop that creates an executable for each member in a test_sources list, and names it according to a test_names list. The problem is that a couple of my unit tests

how to fill off global offset table?

∥☆過路亽.° 提交于 2019-12-25 17:44:42
问题 Motivation: I want to test gcc's limition size of global offset table on my arch(x86). What I have done: use multiple undeclared functions in a shared library ( gcc -nostdlib -shared -o got.so ./got.c ) // got.c extern int itestvariable1; extern int testvariable2; void test(void) { fun1(); ... fun8(); } and readelf --relocs ./got.so : Relocation section '.rela.plt' at offset 0x3a8 contains 8 entries: Offset Info Type Sym. Value Sym. Name + Addend 000000004018 000100000007 R_X86_64_JUMP_SLO

Attempt to call field 'contains' (a nil value) | How can I check the table to see if it has a server?

纵然是瞬间 提交于 2019-12-25 09:02:13
问题 What I am trying (Discord Bot) is to make a command called !say serverID channelID arg The point of this command is that I will pm the bot with this command and the bot writes the arg in the defined channelID from the server. Library (litcord) : https://github.com/satom99/litcord A part of the code (Yes, this has issues...) : local server = client.servers:getAll('id', serverID) if server then if server.contains('id', serverID) then for _, serverID in pairs(server) do if serverID == serverID

Which variable for compiler flags of CMake's ADD_LIBRARY function?

丶灬走出姿态 提交于 2019-12-25 09:00:21
问题 Does exist a variable which contains the compiler flags used in some call to CMake's ADD_LIBRARY function, for example the ones used when we add a module: ADD_LIBRARY(mylib MODULE mysrc.cpp) Or, is there a way of getting such flags? 回答1: Turning my comments into an answer There is not a single CMake variable to get the all compiler flags. The problem is that the CMake generator will finally put together the compiler flags (from various CMake variables and properties incl. from depending

Is there a way to list all required dynamic libraries by perl?

∥☆過路亽.° 提交于 2019-12-25 08:56:52
问题 As we know many perl modules depends on some dynamic libraries to function,loaded by DynLoader (I don't know if there's any other way to load .so though). ./perl_programe Is there a way to list all required dynamic libraries for a specific perl programe? 回答1: Try this script: #! /usr/bin/perl do shift; print "$_\n" for @DynaLoader::dl_shared_objects; It takes the script to check as first (and only) argument. e.g. ./dyna perl_programe 来源: https://stackoverflow.com/questions/6872732/is-there-a

Code directory structure - Library design

与世无争的帅哥 提交于 2019-12-25 08:17:03
问题 below is the code structure, where stack , Queue , tree folder code rely on list folder code, ../Computing >ls HashTable list Queue recursion stack tree list folder duplicated in tree/rootedTree folder unlike recommended approach to include dependent header files, mentioned here, ../Computing/tree/rootedTree >ls lcrsImpl.c list main.c multiWalkImpl.c tree.h here is the incomplete code for rootedTree folder. To avoid code duplication of List folder, How to maintain the code structure? 回答1: You

Arduino: Change defines without edit library [solved, bug in compiler, workaround available]

牧云@^-^@ 提交于 2019-12-25 07:25:42
问题 edit: See my answer below I'm fairly new to the Arduino platform and creating now an USB HID project with the attiny85 (Trinket) library of AdaFruit. See also my previous answered question about the options of this library: Change/Override Trinket (attiny85) USB identification name, device name I'm stumped on a rare C-related limitation (see also latest comment at answer in link above to previous question), the separated late binding of binaries by separated compiling. If you want to change

How to do versioning of a shared library in Linux?

落爺英雄遲暮 提交于 2019-12-25 05:33:08
问题 Windows provides the resource file for version information for an application and DLL. The resource file includes information like version, copyright and manufacturer. We have an shared library and like to add version information. How can we do it on Linux with a shared library? 回答1: The short version is that you do this via the soname of the library. Read chapter 3 at http://tldp.org/HOWTO/Program-Library-HOWTO/shared-libraries.html as well as chapter 3.3 ABI Versioning at http://www.akkadia

Allowing dynamically loaded libraries in C to “publish” functions for use

試著忘記壹切 提交于 2019-12-25 03:41:12
问题 I'm writing a program in C which allows users to implement custom "functions" to be run by an interpreter of sorts. I also want to allow users to write these custom functions in plain C, and then be loaded in dynamically. In order to do this, I created two structs, one for interpreted functions, and one for native ones. Here's a simplified example: struct func_lang { bool is_native; char* identifier; // various other properties } typedef void (*func_native_ptr)(int); struct func_native { bool