1 #include <stddef.h>
2 #include "libtest1.h"
3 
4 class Foo
5 {
6 public:
Foo()7     Foo() { mAddress = NULL; }
8     void setAddress(int *px);
9     ~Foo();
10 private:
11     int *mAddress;
12 };
13 
setAddress(int * px)14 void Foo::setAddress(int *px)
15 {
16     mAddress = px;
17     *mAddress = 1;
18 }
19 
~Foo()20 Foo::~Foo()
21 {
22     if (mAddress)
23         *mAddress = 2;
24 }
25 
26 static Foo foo;
27 
test1_set(int * px)28 extern "C" void test1_set(int *px)
29 {
30     foo.setAddress(px);
31 }
32