shared-libraries

How to Debug Java -JNI using GDB on linux ?

北城余情 提交于 2019-11-29 01:05:36
问题 Can anyone guide on how to debug a JNI code on Linux using GDB debugger(if possible please suggest other options). -My JNI project when running on Linux is leading to a JVM crash. -The CPP code has been compiled into .so files. -I run the project like this : *java xyz.jar -commandline_args_to_project*. I have the Gdb installed but am not getting how we can debug the project using it. Also do I necessarily need to compile the .cpp files with -g option t debug .so files? 回答1: Start your java

Does different process has seperate copy of Shared Static variable or common copy?

南笙酒味 提交于 2019-11-29 00:10:09
I am trying to understand the fundamental of shared memory concept. I trying to create a shared library having one function and one STATIC array variable. I want to access static array variable through the function of that shared library. Here is my shared library //foo.c #include <stdio.h> static int DATA[1024]={1 ,2 ,3 ,...., 1024}; inline void foo(void) { int j, k=0; for(j=0;j<1024;j++) { k=DATA[j]; } k+=0; } I have created shared library object (libfoo.so) by following instructions from shared library Now my questions are 1> If I access foo() from two different program ( program1 and

Compile header-only template library into a shared library?

回眸只為那壹抹淺笑 提交于 2019-11-28 23:45:45
We are in the process of designing a new C++ library and decided to go with a template-based approach along with some specific partial template specialisations for corner cases. In particular, this will be a header-only template library . Now, there is some concern that this will lead to a lot of code duplication in the binaries, since this template 'library' will be compiled into any other shared library or executable that uses it (arguably only those parts that are used). I still think that this is not a problem (in particular, the compiler might even inline things which it could not across

Can I build a shared library by linking static libraries?

做~自己de王妃 提交于 2019-11-28 23:32:10
I have a bunch of static libraries (*.a), and I want to build a shared library (*.so) to link against those static libraries (*.a). How can I do so in gcc/g++? You can (just extract all the .o files and link them with -shared to make a .so ), but whether it works, and how well it works, depends on the platform and whether the static library was compiled as position-independent code (PIC). On some platforms (e.g. x86_64), non-PIC code is not valid in shared libraries and will not work (actually I think the linker will refuse to make the .so ). On other platforms, non-PIC code will work in

Loading time for shared libraries vs static libraries

天涯浪子 提交于 2019-11-28 23:24:02
问题 I have a question on shared libraries vs static libraries loading time. Assume that i have a executable foo.exe which uses liba, libb, libc. Also at a given time there are more than 10 instances of the executable running on the machine. Now if the above 3 libraries were shared libraries : 1st Insance is loaded into RAM : The time taken will be time taken by main() of foo.exe to be loaded memory (assuming its negligible) + time to load liba + time to load libb + time to load libc 2nd instance

dyld: Library not loaded, Reason: image not found

℡╲_俬逩灬. 提交于 2019-11-28 22:38:33
I used gdb normally until this week. Now running gdb I see: (gdb) r Starting program: /Volumes/MyProg dyld: Library not loaded: @rpath/libCore.so Referenced from: /Volumes/MyProg Reason: image not found (gdb) How to fix it? I have: OSX 10.9 GNU gdb (GDB) 7.6 installed with MacPorts P.S. I have reinstalled gdb and Xcode. This does not help. I see a lot of questions about dyld issues, but obviously I lack experience with libraries on OSX, and they appears to be useless for me. For example this topic: dyld issues library not loaded But how to download library again? Or this topic: Dyld: Library

How to recover after deleting the symbolic link libc.so.6?

末鹿安然 提交于 2019-11-28 22:32:44
问题 In our server the symbolic link to libc.so.6 has been deleted. Now none of the binaries in the system work. To fix this, I tried: /bin/ln -s /lib/libc-2.11.3.so /lib/libc.so.6 which, as expected, gives me: /bin/ln: error while loading shared libraries: libc.so.6: cannot open shared object file: No such file or directory I also tried: /lib/ld-linux-x86-64.so.2 --inhibit-rpath /lib/libc.so.6 \ --library-path /lib/libc-2.11.3.so \ /bin/ln -s /lib/libc-2.11.3.so /lib/libc.so.6 with the same

Accessing main program global variables from a dlopen()ed dynamic library in C on OS X

徘徊边缘 提交于 2019-11-28 22:00:51
I am maintaining a small application that has some plugin-like functionality, which is implemented through runtime-loaded dynamic modules. Specifically, since it's a Gtk+ app, I'm using gmodule, but the question applies to dlfcn.h / dlopen() based dynamic library loading just as well. My main program has a single, global struct variable holding some global information. I want this information to be available to functions defined in the dynamically loaded plugins. On Linux, I could just refer to this global variable directly - this works well, and I'm guessing that gcc or the linker take care

Debugging a library with Xcode

a 夏天 提交于 2019-11-28 21:43:49
I have a more general question on working with libraries on with Xcode when building iPhone apps. I've created a framework from a project I've been working on to use some parts of it in other apps. That works pretty good, so far. But I have no idea how to debug into the files included in the included framework. I hope to get some kind of 'best practice' on that. Thanks a lot –f There have been a lot of discussions of how best to reuse code with static libraries. I've settled on the method described here by Clint Harris (which I think is what Shawn is suggesting as well). Creating a project

shared library address space

守給你的承諾、 提交于 2019-11-28 20:53:13
While I was studying about shared library I read a statement Although the code of a shared library is shared among multiple processes, its variables are not. Each process that uses the library has its own copies of the global and static variables that are defined within the library. I just have few doubts. Whether code part of each process are in separate address space? Whether shared-library code part are in some some global(unique) address space. I am just a starter so please help me understand. Thanks! Shared libraries are loaded into a process by memory-mapping the file into some portion