C GUI, with C ++ base?
I have a simple (as well as trivial) banking application that I wrote in C ++. I am on ubuntu, so I am using GNOME (GTK +). I was wondering if I could write my entire GUI in C / GTK + and then somehow link it to my C ++ code. Is it possible?
Note: I do not want to use Qt or GTKmm, so please do not suggest them as answers.
a source to share
Yes, it's very simple. All you have to do is expose some of the C ++ functions as "extern C" so that event handlers and callbacks in your UI code can invoke them.
In case you cannot modify the existing C ++ source, no problem. just write a C ++ shim for your UI, inject these functions and call the backend functions from there.
a source to share
I don't understand why not, with an appropriate extern "C" so your C code can call in C ++. Now, given, you're probably overcomplicating yourself a little, but that sounds in theory.
a source to share
Like others have suggested, you can write a C wrapper for your C ++ library. But you can also write the front-end in C ++, even if you only use a subset of C. I can understand if you don't like mixing languages, but this is the easiest way because you save time to write the wrapper.
a source to share