• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: Interpreting object files symbols
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Interpreting object files symbols


  • Subject: Re: Interpreting object files symbols
  • From: Steve Checkoway <email@hidden>
  • Date: Tue, 30 Aug 2005 13:29:11 -0700


On Aug 30, 2005, at 7:13 AM, Yves Poissant wrote:

In a dylib, I have a function declared as:
BOOL UnlockTempMaps(BOOL DeleteTemps = TRUE);
in the header file. The application that uses the function calls it with
UnlockTempMaps();


The linker complains that the symbol
  __Z17UnlockTempMapsv
is undefined.

As you pointed out it's __Z17AfxUnlockTempMapsv


There are several other symbols in this dylib which the linker doesn't have problem with.


So I'm trying to figure what is that function declaration that the linker is looking for from the symbol "__Z17UnlockTempMapsv".
In particular, what does the appended "v" means?

The appended v means that it takes no arguments (v for void I suppose).

And is there any clue to get from the prepended "Z17"?

C++ function symbols start with __Z followed by a number specifying how many of the following characters are part of the function's name. In this case, 17.


The function 'void foo();' gets mangled to __Z3foov. 'void bar(float, double);' becomes __Z3barfd. The return type is not specified in the name, but the arguments are. In your case, you're looking for 'AfxUnlockTempMaps();'.

Also is there any document that describe the compiler and linker way of building object file symbols?

I'm sure there is somewhere, but it's pretty easy to figure most of it out simply by doing something like:
$ cat name.cpp
void foo() { }
bool bar(int i) { return true; }
char baz(float f, double d) { return 0; }
$ g++ -c name.cpp
$ nm name.o
00000018 T __Z3bari
00000000 A __Z3bari.eh
0000003c T __Z3bazfd
00000000 A __Z3bazfd.eh
00000000 T __Z3foov
00000000 A __Z3foov.eh


- Steve

Attachment: smime.p7s
Description: S/MIME cryptographic signature

 _______________________________________________
Do not post admin requests to the list. They will be ignored.
Xcode-users mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:

This email sent to email@hidden

References: 
 >Interpreting object files symbols (From: "Yves Poissant" <email@hidden>)

  • Prev by Date: Re: How do I get around an illegal reference to symbol?
  • Next by Date: U vs. T in "nm -g" output..
  • Previous by thread: Interpreting object files symbols
  • Next by thread: Re: Interpreting object files symbols
  • Index(es):
    • Date
    • Thread