shared-libraries

Is it possible to create such C++ macros that would wrap your standard (inherited) class into an application?

自古美人都是妖i 提交于 2019-12-02 00:37:38
So we have simple interface base class: class animal { public: animal(int age) : age_(age) { } virtual ~animal(void) { } virtual std::string get_name(void) { return "A generic animal"; } int get_age(void) { return age_; } protected: int age_; }; And we want ti inherit from it with a class like this: #include "animal.hpp" #include "some_includes_for_our_shared_libs.hpp" class puma : public animal { public: puma(int age) : animal(age) {} virtual std::string get_name() { return "puma"; } }; If we are creating a library - shared or static its ok for us just to inherit from it, but when we want to

Linux equivalent of Windows DLL forwarders or MacOS reexport_library

谁说我不能喝 提交于 2019-12-01 23:07:36
I have a shared library that tries to provide a standardized interface, basically a list of functions. Some of these functions are already provided by another shared library. So I could just write the additional functions and ask the user to link to both libraries, i.e. have him do this: g++ foo.c -lmine -lother In order to make things easier for the user, however, I don't want to do that. (Given the situation I'm in, this would be way more complicated than just adding a flag in some script.) I want the user to link only against my library and get the functions from the other library as well.

C++ CMake undefined reference when linking an executable to a third party dependant shared library

坚强是说给别人听的谎言 提交于 2019-12-01 22:34:25
问题 I read a lot of related topics (like 1, 2, 3) but did not find the answer by myself so here I am. I have a CMake project that builds and executable, let say "x". I created a shared library named "a.so" that depends on other shared library called "b.so". I want to use "a" in "x". Here is my simplified "x" CMakelists.txt: SET(ROOT_DIR ${CMAKE_CURRENT_SOURCE_DIR}) LINK_DIRECTORIES(${ROOT_DIR}/lib/a/bin/) # contains liba.so INCLUDE_DIRECTORIES(${ROOT_DIR}/lib/a/include/) # contains "a" headers

ASP.NET Website's BIN directory and references

不羁岁月 提交于 2019-12-01 22:02:09
Imagine the following solution: Website ABC.com (not Web Application) BLL (business logic layer in a seperate assembly) DTO (dto objects in their own assembly) DAL (data access layer in it's own assembly as well). The BLL has a reference to the DAL. The BLL has a reference to the DTO layer. The Website project references the BLL. When one compiles the website project, the following DLLs will appear in the BIN directory: BLL.dll DTO.dll DAL.dll When one goes to preview the site, an error occurs about not having the necessary assembly references... Now if one right clicks on the website project,

Google Apps Script Auto Generated Library Documentation

≯℡__Kan透↙ 提交于 2019-12-01 21:16:13
I am currently developing a Library for Google Apps Script that basically treats a spreadsheet as a database object. Currently, the library has a two identical functions like /** * Opens and creates a query object for a spreadsheet with the given url. * * @param {String} the url of the spreadsheet * @return {SpreadsheetQuery_} a spreadsheet query object for the given spreadsheet */ function openByUrl(url) { return new SpreadsheetQuery_(SpreadsheetApp.openByUrl(url)); } now, for the two public functions, the documentation generated only shows the return type and not the parameter nor the

Keep an exported function from being deleted by the linker

依然范特西╮ 提交于 2019-12-01 21:08:30
I have a program that statically links with several c++ libraries that export a few functions: extern "C" { KSrvRequestHandler* CreateRequestHandler( const char* name ); bool DestroyRequestHandler( KSrvRequestHandler* handler ); const char** ListRequestHandlerTypes(); } The main program then calls these functions using GetProcAddress/dlsym: #ifdef WIN32 HINSTANCE hDll = GetModuleHandle( NULL ); mCreateHandler = GetProcAddress( hDll, createFuncName ); mDestroyHandler = GetProcAddress( hDll, destroyFuncName ); mGetHandlerTypes = GetProcAddress( hDll, listFuncName ); #else // POSIX void* handle =

C++ -malign-double compiler flag

心不动则不痛 提交于 2019-12-01 20:52:13
问题 I need some help on compiler flags in c++. I'm using a library that is a port to linux from windows, that has to be compiled with the -malign-double flag, "for Win32 compatibility". It's my understanding that this mean I absolutely have to compile my own code with this flag as well? How about other .so shared libraries, do they have be recompiled with this flag as well? If so, is there any way around this? I'm a linux newbie (and c++), so even though I tried to recompile all the libraries I'm

Clion & CMake. How To Add Library (*.so)

给你一囗甜甜゛ 提交于 2019-12-01 19:42:09
I trying write code (c/c++) in Clion IDE . I needs add to my project some shared library. In this moment I want to run just simply program (only main function) which will be able add any function witch my external library libAPIenergy.so. I tryed a few solutions from this forum but anyone nothing help. Below I will present solution which give me least errors. in main function I include #include "APIenergy.h" CMake file cmake_minimum_required(VERSION 3.3) project(TestProject) add_library( libAPIenergy SHARED IMPORTED ) link_directories (/home/I/Lib/Linux/x86) set(CMAKE_CXX_FLAGS "${CMAKE_CXX

No output when running ltrace

て烟熏妆下的殇ゞ 提交于 2019-12-01 19:14:44
As the title says, ltrace does not work properly on my system. It shows no output in most cases, like $ltrace ls [usual ls output] +++ exited (status 0) +++ $gcc hello.c $ltrace ./a.out Hello world! +++ exited (status 0) +++ I'm using the latest ltrace version (from package 0.7.3-5.1ubuntu4 ), I even tried recompiling from source with no difference. I'm using Ubuntu 16.10 , kernel 4.8.0-42-generic . gcc version is 6.2.0 . Weird thing is, binaries downloaded from the Internet seem to work, correctly displaying the library calls. What am I missing? Is anyone able to reproduce the issue? This may

Unable to execute Cython wrapped Python code

十年热恋 提交于 2019-12-01 19:05:18
I am exporting C++ API for python code using Cython. The application will be executed on Ubuntu. The project files are present here The function I am wrapping, reads the file name of the image and displays the image. The Show_Img.pyx file looks as follows import cv2 cdef public void Print_image(char* name): img = cv2.imread(name) cv2.imshow("Image", img) while(True): if cv2.waitKey(1) & 0xFF == ord('q'): break The c++ interface generated from Cython looks as follows __PYX_EXTERN_C DL_IMPORT(void) Print_image(char *); The header file is included in my algo.cpp , which calls the function like