shared-libraries

JS - Can't combine lib files

混江龙づ霸主 提交于 2019-11-28 18:09:06
I have multiple lib files in an an index.html file, that are loaded in proper sequence for an app I am running. <!-- example of some of them... --> <script src="/./sys/lib/jquery.min.js"></script> <script src="/./sys/lib/jquery.ui.min.js"></script> <script src="/./sys/lib/jquery.easing.min.js"></script> <script src="/./sys/lib/underscore.min.js"></script> <script src="/./sys/lib/handlebars.min.js"></script> <script src="/./sys/lib/backbone.min.js"></script> <script src="/./sys/lib/moment.min.js"></script> <script src="/./sys/lib/libs.extensions.js"></script> These run fine, they are already

Linking archives (.a) into shared object (.so)

可紊 提交于 2019-11-28 17:56:26
I'm compiling some shared objects file into an archive.a : $ g++ -c -Iinclude/ -fPIC -O0 -o object1.o source1.cpp $ g++ -c -Iinclude/ -fPIC -O0 -o object2.o source2.cpp $ ar rvs archive.a object1.o object2.o r - object1.o r - object2.o So far so good. The resulting archive.a has a good size of some KB. A dump with nm shows that the corresponding object-files are contained within the files. Now I'm wanting to compile several of these archives into a shared object file. g++ -g -O0 -Iinclude/ -I/usr/include/somelibrary -shared -o libLibrary.so archive1.a archive2.a The result is that my resulting

Why is -L needed when -rpath is used?

假装没事ソ 提交于 2019-11-28 17:37:42
问题 I find that the -L flag must be given when using -rpath. For instance: gcc -o test test.o -L. -lmylib -Wl,-rpath=. Why is the -L flag needed? What information more than the information from the h-files are needed at compile time? If I remove -L. I get the following message: gcc -o test test.o -lmylib -Wl,-rpath=. /usr/bin/ld: cannot find -lmyLib It's perfectly ok to remove both flags, though. Like this: gcc -o test test.o -lmylib Provided that libmyLib can be found in /usr/lib, that is. Why

Linking a shared library against a static library: must the static library be compiled differently than if an application were linking it?

浪尽此生 提交于 2019-11-28 17:30:31
At least on Linux and Solaris, static libraries are really just a bunch of compiled .o's tossed into one big file. When compiling a static library, usually the -fpic flag is ommited, so the generated code is position dependent. Now say my static library is B. I've built it and have the resulting .a file which is really just a glob of all of the position dependent .o files. Now I have a shared library I'd like to build, A, and I want it to statically link B. When I build A, naturally I'll use the -fpic flag to make the generated code position independent. But if I link against B, aren't I

Shared libraries and .h files

一个人想着一个人 提交于 2019-11-28 16:55:07
I have some doubt about how do programs use shared library. When I build a shared library ( with -shared -fPIC switches) I make some functions available from an external program. Usually I do a dlopen() to load the library and then dlsym() to link the said functions to some function pointers. This approach does not involve including any .h file. Is there a way to avoid doing dlopen() & dlsym() and just including the .h of the shared library? I guess this may be how c++ programs uses code stored in system shared library. ie just including stdlib.h etc. Nick, I think all the other answers are

What is the difference between LD_LIBRARY_PATH and -L at link time?

空扰寡人 提交于 2019-11-28 16:53:17
I'm having problems with LD_LIBRARY_PATH at link time (this question has nothing to do with run time). The link line looks like this when I run make (this is a Linux system using g++ version 4.1.x): g++ a.o b.o c.o -o myapp \ -L/long/path/to/libs/ \ -L/another/long/path/ \ -labc -ldef -lghi The -l options reference shared libraries (e.g., libabc.so) which exist in the directories specified by the -L options. Those directories also appear in LD_LIBRARY_PATH . With that configuration, the link is successful, and I can run the application. If I remove the directories from LD_LIBRARY_PATH , then I

Determine target ISA extensions of binary file in Linux (library or executable)

拈花ヽ惹草 提交于 2019-11-28 16:35:54
问题 We have an issue related to a Java application running under a (rather old) FC3 on an Advantech POS board with a Via C3 processor. The java application has several compiled shared libs that are accessed via JNI. Via C3 processor is supposed to be i686 compatible. Some time ago after installing Ubuntu 6.10 on a MiniItx board with the same processor, I found out that the previous statement is not 100% true. The Ubuntu kernel hanged on startup due to the lack of some specific and optional

C++ Cross Platform Dynamic Libraries; Linux and Windows

放肆的年华 提交于 2019-11-28 16:20:18
问题 I need some help on writing cross-platform code; not an application, but a library. I am creating a library both static and dynamic with most of the development done in Linux, I have got the static and shared library generated in Linux but now wanted to generate a Windows version of a static and dynamic library in the form of .lib and .dll using the same source code. Is this possible? I'm a bit worried because I noticed generating Windows .dll files required using _dllspec or something

How to list library dependencies of a non-native binary?

﹥>﹥吖頭↗ 提交于 2019-11-28 15:57:43
When developing for native platform, I can use ldd to list all the shared libraries (.so files) a binary executable I build will try to load upon start-up. But when cross-compiling, I don't know how to get the same information. The ldd is not a normal binutils utility, like strip or ar , that can be built alongside gcc for cross compiling, but instead, it is a cryptic shell script that apparently can only run on native platform. So, using the cross-target binutils tools, is there any way to get a list of the dynamically linked dependency for of a foreign binary? is there any way to get a list

Stripping linux shared libraries

帅比萌擦擦* 提交于 2019-11-28 15:48:40
问题 We've recently been asked to ship a Linux version of one of our libraries, previously we've developed under Linux and shipped for Windows where deploying libraries is generally a lot easier. The problem we've hit upon is in stripping the exported symbols down to only those in the exposed interface. There are three good reasons for wanting to do this To protect the proprietary aspects of our technology from exposure through the exported symbols. To prevent users having problems with