shared-libraries

What's the difference between the -symbolic and -shared GCC flags?

泄露秘密 提交于 2019-12-03 07:39:59
问题 From the documentation's description, they seem to do the same thing except that "not all systems" support shared and "only some systems" support symbolic (it's unclear if these are the same set of systems): -shared Produce a shared object which can then be linked with other objects to form an executable. Not all systems support this option. For predictable results, you must also specify the same set of options that were used to generate code (-fpic, -fPIC, or model suboptions) when you

Load Jenkins Pipeline Shared Library from same repository

喜夏-厌秋 提交于 2019-12-03 07:39:55
问题 TL;DR Is there a way to import code into the Jenkinsfile from the local repository (other than the load step)? Why? I've experienced that for complex builds the Jenkinsfile gets kind of bulky and not very maintainable. Now that the build job is code, it would be wonderful to have the same means as for other code. That is, I would like to divide it into smaller (more maintainable) units and unit test them. What I tried shared libraries: allow for dividing our Jenkins Pipeline logic into

Dynamic loaded libraries and shared global symbols

北慕城南 提交于 2019-12-03 07:25:23
Since I observed some strange behavior of global variables in my dynamically loaded libraries, I wrote the following test. At first we need a statically linked library: The header test.hpp #ifndef __BASE_HPP #define __BASE_HPP #include <iostream> class test { private: int value; public: test(int value) : value(value) { std::cout << "test::test(int) : value = " << value << std::endl; } ~test() { std::cout << "test::~test() : value = " << value << std::endl; } int get_value() const { return value; } void set_value(int new_value) { value = new_value; } }; extern test global_test; #endif // __BASE

extending default lib search path in ubuntu

僤鯓⒐⒋嵵緔 提交于 2019-12-03 07:11:59
问题 How can i extend default lib search path in ubuntu(in a way that it is also persistent) ? no, I do not want export LD_LIBRARY_PATH based temporary solution, rather some way to extend the default lib search path ? while google-ing, I cam across some info, that in ubuntu the default search path resides in /etc/ld.so.conf.d , but editing libc.conf does not extended the default path.. so i think either i am doing it wrong, or something is missing... the edited libc.conf looks like... # libc

Crosscompiler Binary compatibility in C

≡放荡痞女 提交于 2019-12-03 07:08:29
I need to verify something for which I have doubts. If a shared library ( .dll) is written in C, with the C99 standard and compiled under a compiler. Say MinGw. Then in my experience it is binary compatible and hence useable from any other compiler. Say MS Visual Studio. I say in my experience because I have tried it successfully more than once. But I need to verify if this is a rule. And in addition I would like to ask if it is indeed so, then why libraries written completely in C, like openCV for example don't provide compiled binaries for every different OS? I know that the obvious reason

Making a shared library from existing object files

帅比萌擦擦* 提交于 2019-12-03 06:53:05
I have a project in my IDE. I need to make a shared library of it to use in extensions. I don't want to make a copy of this project with shared-library settings. Is there any way to build a shared library using the object files (.o) from my already existing project? As I understand, I can write a makefile for this. I assume you're on some sort of Unix and are probably using the GNU toolchain. In that case, to create a proper shared library, you'd need to compile your code using the position-independent code flags (-fpic or -fPIC) before you can create a shared library. Unless your .o files are

Compile Python 2.7.3 from source on a system with Python 2.7 already

拥有回忆 提交于 2019-12-03 06:51:08
I wish to compile Python 2.7.3 from source. The OS is OpenSUSE 11.4 x86_64, which already provides Python 2.7. I'd like to use 2.7.3 for the latest security patches, but it's a shared system so I can't tinker with the system Python interpreter. I compile using ./configure --prefix=/opt/python --enable-shared . No configure errors, so I make . Again no errors. I do a make install (I don't think I need make altinstall , since this installation prefix in /opt/python isn't in use yet). When I try to run the new binary /opt/python/bin/python , Python announces its version as 2.7, not 2.7.3. The

Breakpoints don't work while debugging native Android library in Visual Studio 2015

孤街浪徒 提交于 2019-12-03 06:48:58
On a fresh installation of Visual Studio 2015 I created an Android application and Android native library. Functions from native library are referenced in the app code through DllImport directives. When I select "Xamarin debugger" for main app and start debugging, I am able to stop on breakpoints in C# code, but debugger doesn't step into native function calls. When I select "Microsoft debugger" breakpoints don't work at all. During debugging session all breakpoints are marked as disabled and when I point to them the following message occurs: The breakpoint will not currently be hit. Module

__attribute__((constructor)) call order confusion

对着背影说爱祢 提交于 2019-12-03 06:27:31
The answer here demonstrates that __attribute__((constructor)) is not called after static initialization, it is called in the declaration order. Then, what is the purpose of it, if it is not guaranteed to be called when all data is initialized? We could as well have our ((constructor)) code in the Foo constructor. What I'm looking for is a way to have, in a shared library, a code that will be executed after all static data is initialized and static constructors are called. I saw people recommending __attribute__((constructor)) as a replacement for DllMain; as we can see this is wrong, because

What is __i686.get_pc_thunk.bx? Why do we need this call?

别说谁变了你拦得住时间么 提交于 2019-12-03 06:20:39
问题 When I disassemble my small function, I happened to see this call call 0xf60d2f47 <__i686.get_pc_thunk.bx>. I have no clue why I need this call in my program. Any explanation would be helpful. 回答1: This call is used in position-independent code on x86. It loads the position of the code into the %ebx register, which allows global objects (which have a fixed offset from the code) to be accessed as an offset from that register. Position-independent code is code that can be loaded and executed,