Welcome, Guest. Please login or register. Did you miss your activation email?

Author Topic: SWIG  (Read 3384 times)

0 Members and 1 Guest are viewing this topic.

Trass3r

  • Jr. Member
  • **
  • Posts: 91
    • View Profile
SWIG
« on: January 20, 2011, 12:58:56 pm »
Considering how much work it is to create and maintain a wrapper for sfml, would SWIG be an alternative to contemplate?
This would open it to more programming languages and bring stuff like cross-language polymorphism for free.

Laurent

  • Administrator
  • Hero Member
  • *****
  • Posts: 32498
    • View Profile
    • SFML's website
    • Email
SWIG
« Reply #1 on: January 20, 2011, 01:56:25 pm »
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.
Laurent Gomila - SFML developer

Trass3r

  • Jr. Member
  • **
  • Posts: 91
    • View Profile
SWIG
« Reply #2 on: January 20, 2011, 04:05:10 pm »
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.

Laurent

  • Administrator
  • Hero Member
  • *****
  • Posts: 32498
    • View Profile
    • SFML's website
    • Email
SWIG
« Reply #3 on: January 20, 2011, 04:12:50 pm »
Quote
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?

Quote
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.
Laurent Gomila - SFML developer

Trass3r

  • Jr. Member
  • **
  • Posts: 91
    • View Profile
SWIG
« Reply #4 on: January 20, 2011, 04:44:34 pm »
Quote from: "Laurent"
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++?

Quote
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.

Quote
External libraries can use whatever they like to create their bindings.

Yep, of course, I just wonder if it works flawlessly.

 

anything