dynamic-library

Setting LD_LIBRARY_PATH environment variable for loading a shared library at runtime (g++)

一曲冷凌霜 提交于 2019-12-10 15:23:25
问题 I'm having two problems related to the same issue: I have a shared object saved in `pwd`/lib and while the executable that uses it compiles successfully (by using -l and -L switches), at runtime, it's giving me grief. If I try to run LD_LIBRARY_PATH=/my/absolute/path/to/library/directory ./test it works fine. But if I export LD_LIBRARY_PATH=/my/absolute/path/to/library/directory and do ./test it says that it can't find the shared library. However, if I do LD_LIBRARY_PATH=$LD_LIBRARY_PATH .

Plugin architecture in C using libdl

孤者浪人 提交于 2019-12-10 04:24:55
问题 I've been toying around, writing a small IRC framework in C that I'm now going to expand with some core functionality - but beyond that, I'd like it to be extensible with plugins! Up until now, whenever I wrote something IRC related (and I wrote a lot, in about 6 different languages now... I'm on fire!) and actually went ahead to implement a plugin architecture, it was inside an interpreted language that had facilities for doing (read: abusing) so, like jamming a whole script file trough eval

Size difference between static and dynamic (debug) library and impact on final exe

孤人 提交于 2019-12-09 12:36:17
问题 I never put much thought into the size difference between a static library and a dynamic library until I downloaded pre-built libraries of boost today. I found that the static libraries of boost are much much bigger than the dynamic libraries. For example, the debug multi-threaded boost wave static library is 97.7 mb in size while the same library, but dynamic, is only 1.4 mb in size (including import library and dll)! That is a huge difference. Why is that? Second question, if I statically

Difference between static and dynamic library in Xcode for iPhone

旧城冷巷雨未停 提交于 2019-12-06 17:04:29
问题 What is the difference between a static and dynamic library in XCode? And why doesn't Apple allow us to use dynamic libraries in our iOS applications? 回答1: While you can build dynamic libraries for Mac OS X, you cannot use them for iPhone development. A static library is merely an archive of object files that gets pulled into a program linking against it. The linker will unarchive all the archive files, and pull them in during linking along with the rest of your object files. A dynamic

How to pass arguments to a method loaded from a static library in CPP

Deadly 提交于 2019-12-06 11:48:53
问题 I'm trying to write a program to use a static library of a C++ code into another C++ code. The first C++ code is hello.cpp : #include <iostream> #include <string.h> using namespace std; extern "C" void say_hello(const char* name) { cout << "Hello " << name << "!\n"; } int main(){ return 0; } The I made a static library from this code, hello.a , using this command: g++ -o hello.a -static -fPIC hello.cpp -ldl Here's the second C++ code to use the library, say_hello.cpp : #include <iostream>

Destroying threads in Openmp (C++)

十年热恋 提交于 2019-12-06 11:46:08
问题 Is it possible to destroy the threads created by OpenMP? When the program starts, there is only the one thread. After the parallelized section multiple threads remain since there is a thread pool. Is there any way to destroy this pool after the parallel section is run? I ask because I'm using OpenMP in a dynamic library, and the library handle cannot be closed while the threads are running (the program will segfault). Thanks More explanation: I'm putting all parallelization code into modules

Creating and Using a Simple .dylib

你离开我真会死。 提交于 2019-12-06 06:27:31
问题 What's the most basic way to create and use a .dylib in Xcode? Here's what I have so far: File: MyLib.h #include <string> namespace MyLib { void SayHello(std::string Name); } File: MyLib.cpp #include <string> #include <iostream> #include "MyLib.h" void MyLib::SayHello(std::string Name) { std::cout << "Hello, " << Name << "!"; } I got the project to compile as a dynamic library, but how do I use it with other projects? I tried something like this: File: MyLibTester.cpp #include "libMyLib.dylib

How to create a Dynamic Library in D?

自闭症网瘾萝莉.ら 提交于 2019-12-06 00:46:38
问题 I want to create a Dynamic library (cross-platform) in D, so I did some Googling. After some time I found this page. I am absolutely stunned by how much complexities there are in writing, compiling and even linking to a DLL. Isn't there a uniform way of creating a shared library like you would in C? (just leave out the main function and pass some flags to the linker) 回答1: Well, I decided to spend some time today messing with this and I kinda sorta have something that works, at least if the

PHP unable to load dynamic library “php_pdo_oci.dll”

心已入冬 提交于 2019-12-05 08:29:04
I'm running Apache 2.4.7 with PHP 5.5.9 on Windows 8. I installed PHPUnit and this warning image "warning" started to pop up. Yes I enabled extension loading in php.ini as well as "extension_dir" to correct folder and there is file named "php_pdo_oci.dll" in that folder. I tried to use different apache and php releases, but it didn't help. Any suggestions how to fix this? The ..._oci.dll is part of the Oracle C Interface. Unless you need to use Oracle, I suggest you go to the relevant line inside the php.ini file and uncomment the loading of this extension. However, if you need to use this

Plugin architecture in C using libdl

不想你离开。 提交于 2019-12-05 07:49:11
I've been toying around, writing a small IRC framework in C that I'm now going to expand with some core functionality - but beyond that, I'd like it to be extensible with plugins! Up until now, whenever I wrote something IRC related (and I wrote a lot, in about 6 different languages now... I'm on fire!) and actually went ahead to implement a plugin architecture, it was inside an interpreted language that had facilities for doing (read: abusing) so, like jamming a whole script file trough eval in Ruby (bad!). Now I want to abuse something in C! Basically there's three things I could do define a