Xref: utzoo comp.lang.c++:5125 comp.windows.x:14414 Path: utzoo!utgpu!jarvis.csri.toronto.edu!mailrus!ncar!noao!arizona!sunquest!francis From: francis@sunquest.UUCP (Francis Sullivan) Newsgroups: comp.lang.c++,comp.windows.x Subject: using X11 with C++ callbacks Message-ID: <640@sunquest.UUCP> Date: 19 Oct 89 22:01:37 GMT Organization: Sunquest Information Systems, Tucson Lines: 34 I would like to be able to use C++ callbacks in X11. Since this is not supported, I'm trying to come up with a simple method to simulate this. For now I just write a C wrapper that calls the correct C++ routine, but I get the feeling that there is an easier way. here is an example using wrappers: class dud { char name[8]; public: dud(char *n) { strcpy(name, n);}; who() {printf ("I am %s\n", name);}; }; dud big("big"); dud dum("dum"); // dummy wrappers wrap_big_who() { big.who(); } wrap_dum_who() { dum.who(); } some_prog() { // what I would like // XCallMeBack(big.who); // XCallMeToo(dum.who); // what I have to use XCallMeBack(wrap_big_who); XCallMeToo(wrap_dum_who); } --- Anyway, a cpp method or a c++ method for dealing with the above is desirable. Suggestions are welcome,