-
-
Save chtlp/d5d7696149717346fb36 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// g++ simple.cpp -shared -o libsimple.dylib | |
#include <stdio.h> | |
class Simple { | |
int id_; | |
public: | |
Simple(int id); | |
~Simple(); | |
int id(); | |
}; | |
Simple::Simple(int id) : id_(id) { | |
printf("[%p:%i] Simple()\n", this, id_); | |
} | |
Simple::~Simple() { | |
printf("[%p:%i] ~Simple()\n", this, id_); | |
} | |
int Simple::id() { | |
return id_; | |
} | |
extern "C" { | |
Simple *Simple_Simple(int id) { | |
return new Simple(id); | |
} | |
void Simple__gc(Simple *this_) { | |
delete this_; | |
} | |
int Simple_id(Simple *this_) { | |
return this_->id(); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment