shared-libraries

Automatically Creating Wrappers for Classes Loaded with dlopen()

可紊 提交于 2019-12-06 08:41:15
I'm writing a proxy class that loads a shared library with dlopen() and forwards its member functions to the appropriate members of the proxied class instance inside the loaded shared object behind the scenes. For example, the shared object has a Person class: class Person { ... void setName(std::string name); }; I've added a wrapper file that includes the person.h header and defines the following symbol: extern "C" { void Person_setName(void* instancePointer, std::string name); } This call just forwards to the person object which is the first argument, extern "C" to avoid the whole name

How do you foster the use of shared components in your organization?

一笑奈何 提交于 2019-12-06 07:57:00
问题 If your company or project places an emphasis on (or at least appreciates) the development of code and components that can be reused and shared across projects, what are the "social engineering" things you've needed to do to facilitate the re-use the code? In my experience, code or components that are simply stated as being "reusable" won't be reused unless that code has someone to champion or evangelize it. Otherwise, people simply won't know about it. How do you make sure shared components

Problems Linking to libcuda.so

自闭症网瘾萝莉.ら 提交于 2019-12-06 07:44:06
I am stumped by what seems to be a problem that should be easy to diagnose and fix. I have a C++ source file that makes use of the CUDA Driver API. When I compile it using nvcc , the executable is produced and works without problems. However, when I try to compile it using g++ , the linker complains about undefined references to symbols that are in /usr/lib/libcuda.so : undefined reference to cuDeviceGet' ... undefined reference to cuDeviceComputeCapability' ... undefined reference to cuDeviceGetName' ... undefined reference to cuDeviceTotalMem_v2' ... undefined reference to

Using Static/Shared C Libraries in Higher Level Languages [closed]

佐手、 提交于 2019-12-06 07:41:13
Closed . This question needs to be more focused . It is not currently accepting answers. Want to improve this question? Update the question so it focuses on one problem only by editing this post . Closed 4 years ago . I'm wondering if there is some way to take my custom shared/static libraries, made in C, and use them into another higher language such as python or node.js. I came with this because I'm writing a few libraries to calculate some math stuff. I heard about node.js not being so good for heavy calculations (but is for networking I/O). Hence, I'm really thinking on spend some time in

Why do I have to explicitly link to pthreads in my main.c compilation when my main.c does not use pthreads?

女生的网名这么多〃 提交于 2019-12-06 07:22:33
In Linux, I have a shared library I made that uses pthreads and a main.c that does not. libpthread.so shows up in an ldd of my shared library, which is correct. $ ldd libmapreduce.so.1.0 linux-gate.so.1 => (0x0067d000) libpthread.so.0 => /lib/libpthread.so.0 (0x0058c000) [...] But when I compile and link my main.c that does not use pthreads to my shared library that does, I see: $ icc -Wall -o main main.c -lmapreduce /opt/intel/Compiler/11.1/046/lib/ia32/libiomp5.so: undefined reference to `pthread_atfork' Adding -lpthread to my compile command, i.e., $ icc -Wall -o main main.c -lmapreduce

Can I share a mine library to all applications?

落爺英雄遲暮 提交于 2019-12-06 06:58:22
I have a project (.NET 4, but I can have also .NET 4.5) that always use the same DLL I've made (it's mine Data Layer, more or less). Each website it's an application. I'd like to share this Library I have to each application, so if I do an update I'll update only a "folder", and I don't need to copy/paste this Library on each Bin folder on each web application. Is it possible? Such as, if I create my class MyClass2013 , it will be available for each web application when I load Visual Studio: MyClass2013 myClass = new MyClass2013() without copy and paste the Bin's DLL (where I have the

How does linker find shared library without SONAME

我的梦境 提交于 2019-12-06 06:04:56
问题 if I create a shared library without a SONAME like this gcc -shared libfoo.o -o libfoo.so and link against it, how does the linker find my shared library? Is the filename libfoo.so considered as default SONAME by the linker? 回答1: I think you're right. Here what ld man pages say: -soname=name When creating an ELF shared object, set the internal DT_SONAME field to the specified name. When an executable is linked with a shared object which has a DT_SONAME field, then when the executable is run

MFC state invalid when DLL called through LoadLibrary

六月ゝ 毕业季﹏ 提交于 2019-12-06 05:52:46
问题 i'm fighting with MFC and dynamicly linking DLLs with LoadLibrary. It seems that I cannot get the MFC state right when the app calls DLL, and the DLL calls back in the same call. Ultimately, it leads to tons of asserts. Here is code mock-up of what i'm doing. The application is just normal, straight from the wizard MFC app. I've got button somewhere and this is the button's handler: void callback() { AFX_MANAGE_STATE(AfxGetStaticModuleState( )); CDialog1 dlg; dlg.DoModal(); } typedef void (

Including objects to a shared library from a C++ archive (.a)

匆匆过客 提交于 2019-12-06 05:49:17
问题 I am trying to include some object files into a shared library I am building. Take the following command (things in [ETC] have been omitted for brevity): /usr/bin/c++ -fPIC -std=c++14 -pthread -Iinclude/ext/liveMedia -Iinclude/ext/groupsock [ETC] -g -shared -Wl,-soname,libValkka.so -o lib/libValkka.so CMakeFiles/Valkka.dir/src/avthread.cpp.o CMakeFiles/Valkka.dir/src/opengl.cpp.o [ETC] CMakeFiles/Valkka.dir/src/decoders.cpp.o -lX11 -lGLEW -lGLU -lGL -Wl,--whole-archive lib/libavcodec.a -Wl,-

Why LD_PRELOAD doesn't work for one of loaded shared libraries?

亡梦爱人 提交于 2019-12-06 05:26:25
问题 I have an in-house shared library on RedHat Linux 5.0 that provides functions free and malloc : >nm ./libmem_consumption.so | grep -P -e "\bfree\b|\bmalloc\b" 0000000000006540 T free 00000000000088a0 T malloc This shared library is responsible for providing information about memory consumption of a process. Unfortunatelly there is a problem with this shared library when it is used with Apache httpd . When Apache httpd is run with this library I get a coredump in libc::free and a message that