SFML community forums
General => General discussions => Topic started by: Trass3r on January 20, 2011, 12:58:56 pm
-
Considering how much work it is to create and maintain a wrapper for sfml, would SWIG (http://www.swig.org/) be an alternative to contemplate?
This would open it to more programming languages and bring stuff like cross-language polymorphism for free.
-
I think it has already been discussed, probably a long time ago.
Basically, I don't want to use such an abstraction because it doesn't take advantage of each language's specific features. I prefer to have bindings that are fine-tuned and 100% compliant with the target language, that perfect clones of the C++ API in every language.
Experience on current bindings showed that many things need to be redesigned and customized according to the target language.
-
You mean like special property setters and getters like in D and C#?
I thought the generators would do that automatically, gotta test it sometime.
Another issue that comes to my mind is addon libraries. E.g. SFGUI looks very promising, but doesn't have a wrapper.
-
You mean like special property setters and getters like in D and C#?
Yes, and much more. Another example: transforming all the LoadFromXxx functions to constructors (or Create functions in the C binding). I doubt this can be done automatically.
And what about bindings that must use the C binding, not the C++ API?
Another issue that comes to my mind is addon libraries. E.g. SFGUI looks very promising, but doesn't have a wrapper.
External libraries can use whatever they like to create their bindings.
-
Another example: transforming all the LoadFromXxx functions to constructors (or Create functions in the C binding). I doubt this can be done automatically.
If these functions are supposed to be constructors in other languages, why aren't they constructors in C++?
And what about bindings that must use the C binding, not the C++ API?
SWIG supports D, so it has to (and I'm pretty sure it does) generate a C layer in between.
External libraries can use whatever they like to create their bindings.
Yep, of course, I just wonder if it works flawlessly.