shared-libraries

When to use dynamic vs. static libraries

纵饮孤独 提交于 2019-11-26 01:47:53
问题 When creating a class library in C++, you can choose between dynamic ( .dll , .so ) and static ( .lib , .a ) libraries. What is the difference between them and when is it appropriate to use which? 回答1: Static libraries increase the size of the code in your binary. They're always loaded and whatever version of the code you compiled with is the version of the code that will run. Dynamic libraries are stored and versioned separately. It's possible for a version of the dynamic library to be

C/C++ with GCC: Statically add resource files to executable/library

浪子不回头ぞ 提交于 2019-11-26 01:36:56
问题 Does anybody have an idea how to statically compile any resource file right into the executable or the shared library file using GCC? For example I\'d like add image files that never change (and if they do, I\'d have to replace the file anyway) and wouldn\'t want them to lie around in the file system. If this is possible (and I think it is because Visual C++ for Windows can do this, too), how can I load the files which are stored in the own binary? Does the executable parse itself, find the

Linux error while loading shared libraries: cannot open shared object file: No such file or directory

时光毁灭记忆、已成空白 提交于 2019-11-26 01:03:31
问题 Program is part of the Xenomai test suite, cross-compiled from Linux PC into Linux+Xenomai ARM toolchain. # echo $LD_LIBRARY_PATH /lib # ls /lib ld-2.3.3.so libdl-2.3.3.so libpthread-0.10.so ld-linux.so.2 libdl.so.2 libpthread.so.0 libc-2.3.3.so libgcc_s.so libpthread_rt.so libc.so.6 libgcc_s.so.1 libstdc++.so.6 libcrypt-2.3.3.so libm-2.3.3.so libstdc++.so.6.0.9 libcrypt.so.1 libm.so.6 # ./clocktest ./clocktest: error while loading shared libraries: libpthread_rt.so.1: cannot open shared

Difference between static and shared libraries?

那年仲夏 提交于 2019-11-26 00:29:27
问题 What is the difference between static and shared libraries? I use Eclipse and there are several project types including Static Libraries and Shared Libraries? Does one have an advantage over the other? 回答1: Shared libraries are .so (or in Windows .dll, or in OS X .dylib) files. All the code relating to the library is in this file, and it is referenced by programs using it at run-time. A program using a shared library only makes reference to the code that it uses in the shared library. Static

How to add additional libraries to Visual Studio project?

我的梦境 提交于 2019-11-25 23:37:30
问题 Allergro is an open souce C++ addon library for graphics manipulation. How do I add this library to my compiler? The instructions don\'t work for me as I have Windows 7. I don\'t know if the OS matters. I have the Visual Studio Express Edition. The library is a .dll file. How do I add it to my projects? 回答1: For Visual Studio you'll want to right click on your project in the solution explorer and then click on Properties . Next open Configuration Properties and then Linker . Now you want to

How to use addr2line in Android

可紊 提交于 2019-11-25 23:33:06
I am stuck with my app, as I am unable to debug as it is a multithreaded one and crashes with error SIGSEGV. I get lot of information from LogCat, which gives me addresses in my native library. It would be helpful if I could convert these addresses into my code. Does anybody have any idea how to use addr2line, which is provided with android-ndk? Let's say that logcat show you the following crash log (this is from one of my projects): I/DEBUG ( 31): *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** I/DEBUG ( 31): Build fingerprint: 'generic/sdk/generic:2.3/GRH55/79397:eng/test

Linux error while loading shared libraries: cannot open shared object file: No such file or directory

大城市里の小女人 提交于 2019-11-25 23:16:40
Program is part of the Xenomai test suite, cross-compiled from Linux PC into Linux+Xenomai ARM toolchain. # echo $LD_LIBRARY_PATH /lib # ls /lib ld-2.3.3.so libdl-2.3.3.so libpthread-0.10.so ld-linux.so.2 libdl.so.2 libpthread.so.0 libc-2.3.3.so libgcc_s.so libpthread_rt.so libc.so.6 libgcc_s.so.1 libstdc++.so.6 libcrypt-2.3.3.so libm-2.3.3.so libstdc++.so.6.0.9 libcrypt.so.1 libm.so.6 # ./clocktest ./clocktest: error while loading shared libraries: libpthread_rt.so.1: cannot open shared object file: No such file or directory Edit: OK I didn't notice the .1 at the end was part of the filename.

C++ Dynamic Shared Library on Linux

感情迁移 提交于 2019-11-25 23:13:17
This is a follow-up to Dynamic Shared Library compilation with g++ . I'm trying to create a shared class library in C++ on Linux. I'm able to get the library to compile, and I can call some of the (non-class) functions using the tutorials that I found here and here . My problems start when I try to use the classes that are defined in the library. The second tutorial that I linked to shows how to load the symbols for creating objects of the classes defined in the library, but stops short of using those objects to get any work done. Does anyone know of a more complete tutorial for creating

When to use dynamic vs. static libraries

人走茶凉 提交于 2019-11-25 23:04:09
When creating a class library in C++, you can choose between dynamic ( .dll , .so ) and static ( .lib , .a ) libraries. What is the difference between them and when is it appropriate to use which? Static libraries increase the size of the code in your binary. They're always loaded and whatever version of the code you compiled with is the version of the code that will run. Dynamic libraries are stored and versioned separately. It's possible for a version of the dynamic library to be loaded that wasn't the original one that shipped with your code if the update is considered binary compatible