File: basic

package info (click to toggle)
vtable-dumper 1.2-1.1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 156 kB
  • sloc: ansic: 430; makefile: 32; sh: 26
file content (32 lines) | stat: -rwxr-xr-x 601 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
#!/bin/sh
set -e

WORKDIR=$(mktemp -d)
trap "rm -rf $WORKDIR" 0 INT QUIT ABRT PIPE TERM
cd $WORKDIR
cat <<EOF > sample.cpp
class MyClass
{
public:
  MyClass() {};

  /* use virtual otherwise linker will try to perform static linkage */
  virtual void DoSomething() {};

private:
  int x;
};

class foo: public MyClass {
   virtual void DoSomething() {};
};

class foo f;
class MyClass m;
EOF
g++ -g -c -Wall -fPIC sample.cpp -o sample.o
g++ -shared -Wl,-soname,libsample.so.1 -o libsample.so.1.0.1 sample.o
echo "build: OK"
test -x libsample.so.1.0.1
vtable-dumper ./libsample.so.1.0.1
echo "run: OK"