linker

Call a function in another object file without using PLT within a shared library?

为君一笑 提交于 2020-01-23 20:10:16
问题 I have two assembly codes, code1.s and code2.s and I want to build a relocatable (using -fPIC switch) shared library from these two. I want code2.s call a function, named myfun1 , which is defined in code1.s . When I use call myfun1@PLT in code2.s it finds the function and it works like a charm but it uses PLT section to call this function which is in the same shared library. I want to do this without adhering to PLT section. When I remove @PLT I get the relocation R_X86_64_PC32 against

EClipse CDT/Juno and linker options --start-group

半世苍凉 提交于 2020-01-23 08:08:22
问题 I know the -l and -L options for link but I am looking to set the --start-group and --end-group and all my libraries into my C project (Properties) under CDT/Juno but where do I put this option ???? -Xlinker ? Thanks Marc 回答1: You can insert this options through "Expert settings: Command line patterns". To insert the options -Wl,--start-group and -Wl,--end-group you can edit this field. Follow the steps below: Click in the option GCC C/C++ Linker Edit the field Command line pattern from $

How to link a .lib in Visual Studio 2008 C++

北慕城南 提交于 2020-01-23 02:45:08
问题 I'm finding it really difficult to properly link a .lib file to my C++ Win32 Console Application. Here's my problem. Just as in this MSDN article, I have developed a MathFuncsLib.lib file. http://msdn.microsoft.com/en-us/library/ms235627%28v=vs.80%29.aspx Then, in the MyExecRefsLib Win32 Console App, I want to link to the above file. So, inside MyExecRefsLib folder (same folder where .sln file resides) I created a directory called "LibraryFiles" and placed both MathFuncsLib.lib file AND

Trouble with xamarin.ios/monotouch , mvvmcross and linking

一笑奈何 提交于 2020-01-22 23:31:09
问题 I have an irritating issue, if I use Link SDK Assemblies only in xamarin studio I get an exception, if I use dont link the exception is not happening. I have located the issue to be part of an third party dll i am using(api for a video streaming service). I believe the linker is stripping some of the methods used by this dll. Is it possible skip link of some libraries and is it possible to see which from this stacktrace. 2013-05-08 14:40:54.688 AppsfabrikkenTouch[5662:907] mvx: Diagnostic: 18

Why doesn't a C++ static library project have linker settings?

筅森魡賤 提交于 2020-01-22 17:52:49
问题 Revealing my ignorance: Why doesn't a static library project (in Visual Studio in my case) have linker settings in the project properties page? I thought "linking" was kind of a big deal re: libraries, but apparently I fundamentally misunderstand something. 回答1: Making an executable is a three step process: A compiler transforms source code in to object files. An archiver/librarian groups the object files together into libraries (this step is optional). A linker links the object files and

Why symbols of a shared library are not resolved at link time?

狂风中的少年 提交于 2020-01-21 06:48:32
问题 This is my 2nd post on this site in my effort to understand the compilation/linking process with gcc. When I try to make an executable, symbols need to be resolved at link time, but when I try to make a shared library, symbols are not resolved at link time of this library. They will perhaps be resolved when I am trying to make an executable using this shared library. Hands-on: bash$ cat printhello.c #include <stdio.h> //#include "look.h" void PrintHello() { look(); printf("Hello World\n"); }

Static library & Dynamic library : Confusion

 ̄綄美尐妖づ 提交于 2020-01-20 19:55:31
问题 I need little clarification in this area. I feel that the terms Static library & Dynamic Library are not correct. lib1.o + lib2.o + lib3.o --> "LinkerOutputFile"(executable or library). If this "LinkerOutputFile" contains the code of all the files lib1.o , lib2.o, lib3.o then its said that "LinkerOutputFile" is satically-linked "LinkerOutputFile"(executable or library). (or) If "LinkerOutputFile" just contains references & other information about to lib1.o, lib2.o, lib3.o without containing

Why doesn't the linker complain of duplicate symbols?

前提是你 提交于 2020-01-20 08:26:25
问题 I have a dummy.hpp #ifndef DUMMY #define DUMMY void dummy(); #endif and a dummy.cpp #include <iostream> void dummy() { std::cerr << "dummy" << std::endl; } and a main.cpp which use dummy() #include "dummy.hpp" int main(){ dummy(); return 0; } Then I compiled dummy.cpp to three libraries, libdummy1.a , libdummy2.a , libdummy.so : g++ -c -fPIC dummy.cpp ar rvs libdummy1.a dummy.o ar rvs libdummy2.a dummy.o g++ -shared -fPIC -o libdummy.so dummy.cpp When I try compile main and link the dummy

Why doesn't the linker complain of duplicate symbols?

徘徊边缘 提交于 2020-01-20 08:25:55
问题 I have a dummy.hpp #ifndef DUMMY #define DUMMY void dummy(); #endif and a dummy.cpp #include <iostream> void dummy() { std::cerr << "dummy" << std::endl; } and a main.cpp which use dummy() #include "dummy.hpp" int main(){ dummy(); return 0; } Then I compiled dummy.cpp to three libraries, libdummy1.a , libdummy2.a , libdummy.so : g++ -c -fPIC dummy.cpp ar rvs libdummy1.a dummy.o ar rvs libdummy2.a dummy.o g++ -shared -fPIC -o libdummy.so dummy.cpp When I try compile main and link the dummy

OOP programming with data encapsulation in C

只愿长相守 提交于 2020-01-17 12:42:36
问题 I tried to do data encapsulation in C based on this post here https://alastairs-place.net/blog/2013/06/03/encapsulation-in-c/. In a header file I have: #ifndef FUNCTIONS_H #define FUNCTIONS_H // Pre-declaration of struct. Contains data that is hidden typedef struct person *Person; void getName(Person obj); void getBirthYear(Person obj); void getAge(Person obj); void printFields(const Person obj); #endif In ´functions.c´ I have defined the structure like that #include "Functions.h" enum { SIZE