Pages: 1 [2]
  Print  
Author Topic: variable_* Functions  (Read 2454 times)
Offline (Male) RetroX
Reply #15 Posted on: December 15, 2010, 08:21:19 PM

Master of all things Linux
Contributor
Location: US
Joined: Apr 2008
Posts: 1055
MSN Messenger - classixretrox@gmail.com
View Profile Email
Ah, okay.  I thought that you were just loading the symbols from the binary; apparently, you're just loading the symbols from the currently loaded part in memory.
Logged
My Box: Phenom II 3.4GHz X4 | ASUS ATI RadeonHD 5770, 1GB GDDR5 RAM | 1x4GB DDR3 SRAM | Arch Linux, x86_64 (Cube) / Windows 7 x64 (Blob)
Quote from: Fede-lasse
Why do all the pro-Microsoft people have troll avatars? :(
Offline (Male) Rusky
Reply #16 Posted on: December 16, 2010, 11:39:19 AM

Resident Troll
Joined: Feb 2008
Posts: 960
MSN Messenger - rpjohnst@gmail.com
View Profile WWW Email
That's not quite how it works either. The binary has a symbol table that stores the addresses of names. It may or may not be in memory depending on how the kernel and dynamic linker work. GetProcAddress returns that address, meaning you have a pointer to the variable in memory - symbols are better thought of as "pointers" even if they don't use pointer syntax within the language.
Logged
Offline (Male) RetroX
Reply #17 Posted on: December 16, 2010, 03:35:12 PM

Master of all things Linux
Contributor
Location: US
Joined: Apr 2008
Posts: 1055
MSN Messenger - classixretrox@gmail.com
View Profile Email
That makes sense, then.  I just assumed that the binary's pointers would be inaccurate because it would be different if that one pointer was taken.
Logged
My Box: Phenom II 3.4GHz X4 | ASUS ATI RadeonHD 5770, 1GB GDDR5 RAM | 1x4GB DDR3 SRAM | Arch Linux, x86_64 (Cube) / Windows 7 x64 (Blob)
Quote from: Fede-lasse
Why do all the pro-Microsoft people have troll avatars? :(
Offline (Male) Rusky
Reply #18 Posted on: December 17, 2010, 09:42:20 AM

Resident Troll
Joined: Feb 2008
Posts: 960
MSN Messenger - rpjohnst@gmail.com
View Profile WWW Email
In some cases, especially dynamically linked binaries, it would be. Relocation tables for position-independent executables store all the locations in the binary that need to be updated when symbol addresses change because of where they're loaded in memory. However, GetProcAddress takes care of any of that so any difference is just another layer invisible to the programmer.
Logged
Pages: 1 [2]
  Print