mathmoi wrote:Even if I did write it in C++ and offer a C interface to access it from C programs I would still have to deal with the "simulated inheritance" to pass the game back to C programs.
That depends on what you offer as part of such an interface, which in turn depends on what a user of your library shall be able to do. It might be possible to provide the whole access to a game via C functions without any knowledge about the internal game data structure.
mathmoi wrote:Even if I did write it in C++ and offer a C interface to access it from C programs I would still have to deal with the "simulated inheritance" to pass the game back to C programs.
That depends on what you offer as part of such an interface, which in turn depends on what a user of your library shall be able to do. It might be possible to provide the whole access to a game via C functions without any knowledge about the internal game data structure.
Sven
I would suggest the opposite: write a C library and C++ wrappers for it. There is even a tool for automating it http://developer.gnome.org/gtkmm-tutori ... es.html.en
However, it seems tightly bound to GTK stuff. I don't know if this tool can be used in a more general way, without any links to GTK.
Theory and practice sometimes clash. And when that happens, theory loses. Every single time.
mathmoi wrote:Even if I did write it in C++ and offer a C interface to access it from C programs I would still have to deal with the "simulated inheritance" to pass the game back to C programs.
That depends on what you offer as part of such an interface, which in turn depends on what a user of your library shall be able to do. It might be possible to provide the whole access to a game via C functions without any knowledge about the internal game data structure.
Sven
I would suggest the opposite: write a C library and C++ wrappers for it. There is even a tool for automating it http://developer.gnome.org/gtkmm-tutori ... es.html.en
However, it seems tightly bound to GTK stuff. I don't know if this tool can be used in a more general way, without any links to GTK.
My plan was to write the parser in C and let C++ programmers use it as is. C being a subset of C++ (I know it's not really), it is easier for C++ programmers to use C code than the opposite. This being said, I might provide a C++ wrapper in the future to make the interface more natural in a C++ program.