View previous topic :: View next topic |
Author |
Message |
bioinfornatics
Joined: 22 Jun 2010 Posts: 90
|
Posted: Sun Oct 03, 2010 7:36 pm Post subject: SFML |
|
|
hello which project i need use for sfml ?
- derelict
- DSFML (in sfml trunk) |
|
Back to top |
|
|
mutable
Joined: 22 Jun 2010 Posts: 87
|
Posted: Mon Oct 04, 2010 2:36 am Post subject: |
|
|
Both can you use for SFML, but Derelicts SFML is functional, DSFML is like SFML in C/C++ |
|
Back to top |
|
|
mutable
Joined: 22 Jun 2010 Posts: 87
|
Posted: Wed Dec 28, 2011 9:04 am Post subject: |
|
|
Now that it is possible to interface to C++, there are any plans to make the SFML binding "correct" which means that it can use as SFML in C++ with Classes and Objects?
I tried in the past to use DSFML, but i can't so far. That the reason why i started programming Dgame. |
|
Back to top |
|
|
aldacron
Joined: 05 May 2004 Posts: 1322 Location: Seoul, South Korea
|
Posted: Thu Dec 29, 2011 10:32 pm Post subject: |
|
|
No, I have no plans to bind to the C++ version. The support for C++ in D makes no difference in Derelict, because there is no static linking. Because Derelict loads shared libraries dynamically, there are a couple of major issues.
The first problem is name mangling. Every C++ compiler mangles function names differently. So in order for a shared libraries from multiple compilers to be supported, the loader would have to take into account the name mangling scheme of each compiler. That alone is something I don't even want to think about.
The second problem is how to load the classes. Even in C++, when dynamically loading a shared library (at least DLLs on Windows, not sure on posix systems) it is necessary to provide a method in the DLL to create an instance of a specific class. As far as I know, there is no other way to do it.
Both of these problems make it very difficult, if not impossible, to create Derelict-style bindings to C++ libraries. If the libraries provide functions with C linkage, and a way to create instances of a class via a method call, then it's possible. And that's essentially what CSFML does.
If you want to bind with the C++ version of SFML using D's C++ compatibility, you'll need to create a direct binding and link with the import library on Windows or the shared object file on Linux. _________________ The One With D | The One With Aldacron | D Bits |
|
Back to top |
|
|
doob
Joined: 06 Jan 2007 Posts: 367
|
Posted: Sat Dec 31, 2011 9:19 am Post subject: |
|
|
mutable wrote: | Now that it is possible to interface to C++, there are any plans to make the SFML binding "correct" which means that it can use as SFML in C++ with Classes and Objects?
I tried in the past to use DSFML, but i can't so far. That the reason why i started programming Dgame. |
If you create bindings to a C++ library you still need a C/C++ function that create the class instances. |
|
Back to top |
|
|
|