Hi,
I want to generate C wrappers from C++ libraries. There are tutorials on how to do it by hand:
- http://developers.sun.com/solaris/articles/mixing.html
- http://www.parashift.com/c++-faq-lite/mixing-c-and-cpp.html
- http://yosefk.com/c++fqa/mixing.html
But it is too much of a manual labor.
For example, for this:
struct RtAudio {
virtual DeviceInfo const& f() {...}
class DeviceInfo {
virtual void g() { ... }
};
...
};
I need to write:
struct RtAudioC {
RtAudio x;
};
struct DeviceInfo {
RtAudio::DeviceInfo x;
};
extern "C" {
RtAudioC* newRtAudio() {
return new RtAudioC;
}
void deleteRtAudio(RtAudioC *p {
delete p;
}
/* do something with RtAudio::f() */
void g(DeviceInfo *p) {
try {
p->x.g();
} catch (SomeError & err) {
}
}
}
Are there tools that can automate this process?
Thank you.