shared-libraries

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

我们两清 提交于 2019-12-02 21:07:18
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 specify this option.[1] -symbolic Bind references to global symbols when building a shared object. Warn

Link a static library to a shared one during build?

笑着哭i 提交于 2019-12-02 20:48:37
I have a problem building a shared library with GCC/Linux. Currently this shared library is created with GCC/libtool option "-shared" and everything is fine. Now there are two additional, static libraries (.a-files) that have to be added to this shared one since they provide some functionality that is required by the shared one. Adding these static libraries with option "-l" does not help, afterwards they are not part of the .so file. So how can I force GCC/libtool to really add the code of these static libraries to the shared library? Thanks! Dmitry Yudakov You need --whole-archive linker

extending default lib search path in ubuntu

老子叫甜甜 提交于 2019-12-02 20:43:09
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 default configuration /usr/local/lib:/path_to_my_libraries/lib isti_spl create (as root) a new file in /etc

Shared Libraries: Windows vs Linux method

柔情痞子 提交于 2019-12-02 20:21:22
I have a quick question about Windows shared libraries (DLLs) vs Linux shared libraries (SOs). Why is it that when you create a Windows DLL it requires the client program to also link against a static library (.lib file), but applications created in Linux does not require any linking against such static library. Does it have anything to do with code relocation and the like? Thanks. Not actually with code relocation, that's a totally different issue. It is about a difference in architecture: In Windows, a DLL is just like a executables (EXE). The main difference between an EXE and a DLL is that

Compile shared library into a program?

杀马特。学长 韩版系。学妹 提交于 2019-12-02 19:54:15
问题 I wrote a program, that uses a shared library installed on my system. This library is seldom installed on other systems. How do I compile my program so that the library doesn't need to be installed on other systems? I have the source code for the library available. What's the best way? The other systems of course have the same architecture and OS. 回答1: Compile it as a static library and link that into the executable. 回答2: Though the OP had solved his problem by answering a different question,

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

怎甘沉沦 提交于 2019-12-02 18:49:48
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. 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, unmodified, at different addresses. It is important for code that will be linked into shared libraries,

Calling C shared library function from LibreOffice Basic

丶灬走出姿态 提交于 2019-12-02 18:24:33
问题 I'm trying to call a C shared library function from LibreOffice Basic, but I always get "Basic Runtime Error. Not implemented" when it hits the Declare line. It's just for a fun thing but being unable to do it is bugging me. The Declare statement looks like this: Declare Function score_word Lib "libscrabblescore.so" (ByRef word As String, ByRef bonus As String) As Integer The C function delaration looks like this: int score_word(char* word, char* word_bonuses) (Maybe ByRef word As String is

Is there any way to override the -fvisibility=hidden at link time?

时光怂恿深爱的人放手 提交于 2019-12-02 18:05:00
问题 We are using an third party static library, let say A.a for android development. We link it as shared library and it works fine in the one App, but when use B.so to build another C.so , some symbols in A.a cannot find. We have already use -Wl,--export-dynamic and -Wl,--whole-archive to build B.so . We have using nm to check those symbols, it exist but list as “t” instead of “T” ,which means it is local symbols instead of external. Seams the A.a are build with -fvisibility=hidden after som

Is there a .def file equivalent on Linux for controlling exported function names in a shared library?

こ雲淡風輕ζ 提交于 2019-12-02 17:41:42
I am building a shared library on Ubuntu 9.10. I want to export only a subset of my functions from the library. On the Windows platform, this would be done using a module definition ( .def ) file which would contain a list of the external and internal names of the functions exported from the library. I have the following questions: How can I restrict the exported functions of a shared library to those I want (i.e. a .def file equivalent) Using .def files as an example, you can give a function an external name that is different from its internal name (useful for prevent name collisions and also

QT 5.5.1 .so library with android

给你一囗甜甜゛ 提交于 2019-12-02 16:54:58
问题 I have downloaded openssl compiled library for armeabi and x86 android platforms from here and tried to load it in the .pro file: INCLUDEPATH += C:\Temp\openssl\OpenSSL-for-Android-Prebuilt\openssl-1.0.2\include\ LIBS += -LC:\Temp\openssl\OpenSSL-for-Android-Prebuilt\openssl-1.0.2\armeabi-v7a\lib \ -llibssl -llibcrypto I have also tried with -llibssl.so -llibcrypto.so and -llibssl.a -llibcrypto.a but this error occures: collect2.exe:-1: error: error: ld returned 1 exit status The code is