name-mangling

g++ undefined reference although symbol is present in *.so file

|▌冷眼眸甩不掉的悲伤 提交于 2019-12-30 01:34:07
问题 I found a number of similar questions (e.g. this, that or this), but none of them helped me solve my problem. I have a *.so file (from the core of gnss-sdr) that, as indicated by: $nm libgnss_system_parameters_dyn.so | c++filt |grep Gps_Eph contains the symbol Gps_Ephemeris::Gps_Ephemeris() , which is supposed to be a constructor. I've written some minimal code: #include <iostream> #include <core/system_parameters/gps_ephemeris.h> int main(int argc,const char* argv[]) { Gps_Ephemeris ge;

Delphi - unmangle names in BPL's

北城以北 提交于 2019-12-29 04:02:24
问题 Is it possible to unmangle names like these in Delphi? If so, where do I get more information? Example of an error message where it cannot find a certain entry in the dbrtl100.bpl I want to know which exact function it cannot find (unit, class, name, parameters, etc). --------------------------- myApp.exe - Entry Point Not Found --------------------------- The procedure entry point @Dbcommon@GetTableNameFromSQLEx$qqrx17System@WideString25Dbcommon@IDENTIFIEROption could not be located in the

Two mangled names demangling to the same function signature

感情迁移 提交于 2019-12-25 02:14:41
问题 I have a spidermonkey library that exports the following mangled symbol fora function JS_DefineProperty : _Z17JS_DefinePropertyP9JSContextP8JSObjectPKcN2JS5ValueEPFiS0_NS5_6HandleIS2_EENS7_I4jsidEENS5_13MutableHandleIS6_EEEPFiS0_S8_SA_iSC_Ej When I try to compile a file that uses this function, the external reference is compiled as: _Z17JS_DefinePropertyP9JSContextP8JSObjectPKcN2JS5ValueEPFiS0_NS5_6HandleIS2_EENS7_IlEENS5_13MutableHandleIS6_EEEPFiS0_S8_S9_iSB_Ej The end of the name is

GNU linker: Adapt to change of name mangling algorithm

喜夏-厌秋 提交于 2019-12-23 18:52:40
问题 I am trying to re-compile an existing C++ application. Unfortunately, I must rely on a proprietary library I only have a pre-compiled static archive of. I use g++ version 7.3.0 and ld version 2.30. Whatever GCC version it was compiled with, it is ancient. The header file defines the method: class foo { int bar(int & i); } As nm lib.a shows, the library archive contains the corresponding exported function: T bar__4fooRi nm app.o shows my recent compiler employing a different kind of name

C++ get the mangled names of a function/method

时光毁灭记忆、已成空白 提交于 2019-12-23 10:24:43
问题 Hi I need to determine the mangled name of a function from within an c++ app itself. Is there any equivalent to the __FUNCDNAME__ macro in g++ ? 回答1: To get the demangled name use __PRETTY_FUNCTION__. Better is to use: #include <boost/current_function.hpp> BOOST_CURRENT_FUNCTION This gives the demangled name. I looked at cxxabi.h but there does not seem to be a mangle function. Do you really want the mangled name? 来源: https://stackoverflow.com/questions/3262585/c-get-the-mangled-names-of-a

Is the return type of a function part of the mangled name?

a 夏天 提交于 2019-12-22 09:18:04
问题 Suppose I have two functions with the same parameter types and name (not in the same program): std::string foo(int x) { return "hello"; } int foo(int x) { return x; } Will they have the same mangled name once compiled? Is the the return type part of the mangled name in C++? 回答1: As mangling schemes aren't standardised, there's no single answer to this question; the closest thing to an actual answer would be to look at mangled names generated by the most common mangling schemes. To my

unresolved external symbol due to name mangling

荒凉一梦 提交于 2019-12-21 16:57:14
问题 I am facing linker error for a XERCES function while upgrading it from 2.6 to 2.8 unresolved external symbol (?resolveEntity@HandlerBase@xercesc_2_8@@UAEPAVInputSource@2@QBG0@Z) I checked the xerces-c_2.8.lib and found that name lib is bit different that the one in my .obj file It is as shown ?resolveEntity@HandlerBase@xercesc_2_8@@UAEPAVInputSource@2@QB_W0@Z So I understand that linker wont find the match and throw error. But I am unable to understand why my .obj file contains different

GCC linking / symbol name mangling with C++ and assembler files

天涯浪子 提交于 2019-12-20 03:53:47
问题 I'm having some trouble compiling and linking a library that's written in assembler with my program code which is in C++. In my case it's for an AVR microcontroller using the avr-gcc suite, but I imagine this problem would apply to GCC generally. I can get .o files built from the C++ source and assembly, but linking them gives the error: > avr-gcc -mmcu=attiny84 -lm -o obj\AvrTest.elf obj\Main.o obj\i2cmaster.o obj\Main.o: In function `main': Main.cpp:(.text+0x0): undefined reference to `i2c

Template which prints the name of the given type

别来无恙 提交于 2019-12-20 01:39:16
问题 I would like to print the name of a type for debugging purposes, so I've created a function which does the trick (in fact, I borrowed it from another SO answer, which I cannot found now), the function looks like this: template <typename T> std::string TypeName(T) { auto name = typeid(T).name(); int status = 0; std::unique_ptr<char, void(*)(void*)> res { abi::__cxa_demangle(name, NULL, NULL, &status), std::free }; return ((status == 0) ? res.get() : name); } Live Demo It works fine: int i = 0;

Odd VS name mangling behavior?

元气小坏坏 提交于 2019-12-19 22:00:43
问题 Consider the following do-nothing code, which I am compiling as C++ on Win10 64-bit: int test(int argc, char *argv[]); int main(int argc, char *argv[]) { return test(argc, argv); } int test(int argc, char **argv) { return 0; } If all of this code is placed in the same .cpp file it compiles and links correctly in VS2012, VS2013, VS2015, and mingw32-g++ v4.7.1, as I would expect it to. However, if I simply move the definition of the test function into a separate file the resulting two files