linker

The State of Linkers for .NET apps (aka “Please Sir, May I have a Linker” 2009 edition)

放肆的年华 提交于 2019-12-27 18:22:06
问题 Many people here are probably familiar with one of Joel Spolsky most popular blog posts, Please Sir, May I Have a Linker, where he cries out for a way to remove dependencies on the .NET framework so a stand-alone application can be developed and sold. Jason Zander of the Visual Studio development team, at the time, replied with his views on the topic, arguing that the topic is somewhat moot - the ability to fix security problems in the runtime (among other points) was their chief concern.

Compilation fails with “relocation R_X86_64_32 against `.rodata.str1.8' can not be used when making a shared object”

别来无恙 提交于 2019-12-27 12:15:26
问题 I'm trying to compile this source code from the makefile in a VPS, but its not working. The VPS is a 64 Cent OS Here's the full error # make gcc -c -O3 -w -DLINUX -I../SDK/amx/ ../SDK/amx/*.c g++ -c -O3 -w -DLINUX -I../SDK/amx/ ../SDK/*.cpp g++ -c -O3 -w -DLINUX -I../SDK/amx/ *.cpp g++ -O2 -fshort-wchar -shared -o "TCP_V1.so" *.o /usr/bin/ld: TCP-LINUX_V1.o: relocation R_X86_64_32 against `.rodata.str1.8' can not be used when making a shared object; recompile with -fPIC TCP-LINUX_V1.o: could

g++ linking order dependency when linking c code to c++ code

南笙酒味 提交于 2019-12-27 11:24:07
问题 Prior to today I had always believed that the order that objects and libraries were passed to g++ during the linking stage was unimportant. Then, today, I tried to link from c++ code to c code. I wrapped all the C headers in an extern "C" block but the linker still had difficulties finding symbols which I knew were in the C object archives. Perplexed, I created a relatively simple example to isolate the linking error but much to my surprise, the simpler example linked without any problems.

CMake - Only link a library to an executable if it is needed

岁酱吖の 提交于 2019-12-26 03:53:12
问题 I have a project that includes several source files, and I am using the GoogleTest library to create unit tests for some of these source files. The tests are all separate .cpp files and each includes the header of the respective source file to be tested. I want to create a separate executable for each unit test. To do this I have a loop that creates an executable for each member in a test_sources list, and names it according to a test_names list. The problem is that a couple of my unit tests

CMake - Only link a library to an executable if it is needed

不羁岁月 提交于 2019-12-26 03:53:04
问题 I have a project that includes several source files, and I am using the GoogleTest library to create unit tests for some of these source files. The tests are all separate .cpp files and each includes the header of the respective source file to be tested. I want to create a separate executable for each unit test. To do this I have a loop that creates an executable for each member in a test_sources list, and names it according to a test_names list. The problem is that a couple of my unit tests

import multiple cpp files with pybind11 and cppimport

让人想犯罪 __ 提交于 2019-12-25 18:34:51
问题 How can import multiple cpp files with pybind11? As soon as my project spans over more than a single cpp file, I get an error: raise LinkError(msg) E distutils.errors.LinkError: command 'C:\\Program Files (x86)\\Microsoft Visual Studio\\2019\\Community\\VC\\Tools\\MSVC\\14.24.28314\\bin\\HostX86\\x64\\link.exe' failed with exit status 1120 Any suggestions what I can do about it? Here an example how it could look like: other.h void MyFunc(); main.cpp /* <% setup_pybind11(cfg) %> */ #include

How to properly organize multiple .c and .h files in different directories, so it is includable as <foo.h> elsewhere?

老子叫甜甜 提交于 2019-12-25 18:22:13
问题 I asked this question a while back: How to make C library installable with angle brackets as <mylib.h> on Mac. I am trying to do the same sort of thing, but don't exactly remember all the details / I'm not sure if I'm doing it right. So I have a production example working, but it seems like things aren't organized right (even though it seems to be compiling and running properly). My question is, how can I clean this up and remove some duplication and remove anything unnecessary? So here is my

how to fill off global offset table?

∥☆過路亽.° 提交于 2019-12-25 17:44:42
问题 Motivation: I want to test gcc's limition size of global offset table on my arch(x86). What I have done: use multiple undeclared functions in a shared library ( gcc -nostdlib -shared -o got.so ./got.c ) // got.c extern int itestvariable1; extern int testvariable2; void test(void) { fun1(); ... fun8(); } and readelf --relocs ./got.so : Relocation section '.rela.plt' at offset 0x3a8 contains 8 entries: Offset Info Type Sym. Value Sym. Name + Addend 000000004018 000100000007 R_X86_64_JUMP_SLO

E2045 Bad object file Format:“XXX.obj”

最后都变了- 提交于 2019-12-25 17:17:22
问题 I am working on one migration project from x32 bit to x64 . Here I am using this code: {$L com_1.obj} {$L com_is1.obj} {$L com_2.obj} But while compiling code I am getting error as [dcc64 Error] XXX.dpr(919): E2045 Bad object file format: 'E:\MyProj\com_sha.obj' I am not able to trace why it is happening. Is it due to 32 bit obj file used for compiling x64 bit delphi project? If it is I have also tried to create a obj file with x64 bit environment. Can anyone please help me on this? I am

Error while running poky-qemu: version `GLIBC_2.17' not found. How to solve this?

て烟熏妆下的殇ゞ 提交于 2019-12-25 16:24:26
问题 I am using 32Bit Ubuntu 14.04, where newest version of libc6 is already installed. When I run 'poky-qemu qemuppc zImage-2.6.37-qemuppc-1.0.bin yocto-image-lsb-sdk-qemuppc-1.0.rootfs.ext3' , I am getting following error: /opt/poky/1.0/sysroots/i686-pokysdk-linux/usr/bin/qemu-system-ppc: /opt/poky/1.0/sysroots/i686-pokysdk-linux/lib/libc.so.6: version `GLIBC_2.17' not found (required by /usr/lib/i386-linux-gnu/libdrm.so.2) Is this problem in toolchain or my host machine? How to solve this error