linker

Not sure how to export Objective-C classes. Undefined symbols for architecture i386

♀尐吖头ヾ 提交于 2020-05-15 05:39:48
问题 I'm trying to do some work on GTK+ on OSX and I'm having a little trouble because, to be honest, I'm not all that familiar with Objective-C. I have enough programming experience that I quickly got up to speed on the basic syntax, and I can look up what I need in documentation. But the problems I'm having are related to linking the library and exposing the classes to the program I'm linking to. GTK+ is a C library, but the OSX backend includes a couple Objective-C classes. They're not exposed

ELF: linking: Why do I get undefined references in .so files

回眸只為那壹抹淺笑 提交于 2020-05-10 04:42:48
问题 I'm trying to build a program against wxWidgets, and I get a linker error. I'd like to really understand what it means. The error is: /usr/lib/libwx_baseu-2.8.so: undefined reference to `std::ctype<char>::_M_widen_init() const@GLIBCXX_3.4.11' What I don't understand is why the error is at libwx_baseu-2.8.so . I thought that .so files had all its symbols resolved, contrary to .o files that still need linking. When I ldd the .so , I get can resolve all its linked libraries, so there is no

ELF: linking: Why do I get undefined references in .so files

心不动则不痛 提交于 2020-05-10 04:42:04
问题 I'm trying to build a program against wxWidgets, and I get a linker error. I'd like to really understand what it means. The error is: /usr/lib/libwx_baseu-2.8.so: undefined reference to `std::ctype<char>::_M_widen_init() const@GLIBCXX_3.4.11' What I don't understand is why the error is at libwx_baseu-2.8.so . I thought that .so files had all its symbols resolved, contrary to .o files that still need linking. When I ldd the .so , I get can resolve all its linked libraries, so there is no

Viewing the exact memory range that a linker 'uses' for a executable binary

别等时光非礼了梦想. 提交于 2020-04-17 21:45:28
问题 I am doing a bit of OSdev, and I've been trying to implement memory management in my kernel. I have started off with a physical memory manager (this is a 32 bit OS). The idea is to keep a table of bits where we allocate a bit per 4K physical memory block. If the bit is '1', the block is in use and if '0', it isn't. I thought that this table should come after the kernel. So here is my kernel code (minimal): #include<stdint.h> #define PMMAP 0x1000 //This contains information from int 15h/E820

Viewing the exact memory range that a linker 'uses' for a executable binary

假如想象 提交于 2020-04-17 21:41:46
问题 I am doing a bit of OSdev, and I've been trying to implement memory management in my kernel. I have started off with a physical memory manager (this is a 32 bit OS). The idea is to keep a table of bits where we allocate a bit per 4K physical memory block. If the bit is '1', the block is in use and if '0', it isn't. I thought that this table should come after the kernel. So here is my kernel code (minimal): #include<stdint.h> #define PMMAP 0x1000 //This contains information from int 15h/E820

Passing array/tuple from python back to c++

狂风中的少年 提交于 2020-04-17 20:38:27
问题 I am trying to pass a list to python from cpp and taking it back. Initially I tried to pass a single value and get back one value. It worked. Now I am trying to pass the complete array/list Below is my cpp code: #include <iostream> #include <Python.h> #include <numpy/arrayobject.h> #include <typeinfo> using namespace std; int main() { Py_Initialize(); PyObject *sys = PyImport_ImportModule("sys"); PyObject *path = PyObject_GetAttrString(sys, "path"); PyList_Append(path, PyString_FromString("."

Exporting symbols in static library that is linked to dynamic library

╄→尐↘猪︶ㄣ 提交于 2020-04-16 02:51:46
问题 I have the following scenario in MSVC2017: A static library with the function bool foo() A dynamic link library that links to the static library above An application that loads the dynamic link library using explicit run-time linking and calls foo() via GetProcAddress In the static library, foo() is defined as follows: extern "C" __declspec(dllexport) bool foo() { return true; } Now, because foo() is not used by the dynamic link library, its symbol is not exported and thus not findable when

expanded command line too long

♀尐吖头ヾ 提交于 2020-04-10 05:37:33
问题 I face with a problem in linking phase, while working with MSVC9 . It says: NMAKE : fatal error U1095: expanded command line link.exe . . . too long 回答1: lol that sucks but we need more information to answer your question. OS for starters, basically, it is saying that the command line to call the linker is bigger than the buffer allows in cmd.exe itself. If i remember correctly there may be a way to make the command shell utilize a bigger buffer on the command line. Or you can possibly change

Linker does not emit multiple definition error when same symbol coexists in object file and static library

柔情痞子 提交于 2020-04-08 10:52:18
问题 Given a compiled function with signature void some_func() in a static library, and another one with the same void some_func() signature in a object file one expects that when you link them together a "multiple definition" error should have occured. But this is not the case. As far as i've observed the linkers (tested with GCC and MSVC toolchains) choose the implementation residing in the object file without emitting any error or warning. Given the following POC: somelib.h #ifndef _SOMELIB_H_

How to extend a ELF binary

两盒软妹~` 提交于 2020-03-28 03:56:53
问题 I am writing a small instrumentation tool. I must insert the instrumentation routine within the binary file. A good approach should be to insert those routines in a separate code segment and a separate data segment, could you explain how to accomplish this? Furthemore how can I modify the size of the code segment in the original file? Best, 回答1: I must insert the instrumentation routine within the binary file. A good approach should be to insert those routines in a separate code segment and a