Your cart is currently empty!
6.1 Assignment For this lab, you will implement some C++ functions for a queue ADC using an array. The main difficulty in linking assembly language with C++ is that C++ compilers “mangle” the names of class member functions. In order to write them in assembly, we must discover what name the C++ compiler…
6.1 Assignment
For this lab, you will implement some C++ functions for a queue ADC using an array. The main difficulty in linking assembly language with C++ is that C++ compilers “mangle” the names of class member functions. In order to write them in assembly, we must discover what name the C++ compiler creates. The second issue is that the C++ compiler always passes a pointer to the object, as the first parameter. So a C++ class member function has a “hidden” parameter, which is a pointer to the object being modified.
For example, given the following C++ class,
1
2
3
4
5
6
7
8
9
10
11
12
13
14
class example_class{
private:
.
.
.
public:
.
.
.
int do_something(int x, int j);
.
.
.
}
the do_something member function would be mangled so that its C prototype looks like this:
Additionally, a C++ objects are stored in memory in the same way as C structs. The only real difference is that C++ objects can have virtual functions. Virtual functions are stored in the “struct” as pointers to the actual functions.
6.2 Instructions
1 lpyeatt@rp01 $ tar xfz queue.tgz
1 lpyeatt@rp01 $ objdump –syms queue.o