Giter Club home page Giter Club logo

Comments (11)

denizzzka avatar denizzzka commented on August 24, 2024

(currently SFML can be built only as shared library on linux)

from dsfml.

denizzzka avatar denizzzka commented on August 24, 2024

(I am make a derelict branch right now)

from dsfml.

denizzzka avatar denizzzka commented on August 24, 2024

hoho! I think I got a little excited!
graphics.d easier to rewrite again :( It does not uses OOP from CSFML

from dsfml.

Jebbs avatar Jebbs commented on August 24, 2024

I don't use Derelict style bindings because it will unload everything at a modular scope, which will not let the destructors work the way they do. I do this as a "just in case" sort of thing so that memory is still released upon exit of the program.

Also, the Derelict binding is still extern(C), since it relies on the C binding of SFML, which can only be built as a shared library no matter what OS you are using. The difference between the way DSFML and Derelict-SFML links with the shared library is that DSFML requires the user to link against the import libraries when building(for you it would be something like libcsfml-system.a for example), but Derelict does not. You can still run a DSFML program on linux. I know some people already do.

from dsfml.

Jebbs avatar Jebbs commented on August 24, 2024

If it is alright with you, I think we can close this. You are more than welcome to do something with Derelict to make a wrapper, but DSFML will continue to use static bindings instead of dynamic ones.

I'll also be working more on making sure there are good tutorials for the library soon after the next version is released, but feel free to post on the SFML forums or email me with questions about how to build using DSFML.

from dsfml.

denizzzka avatar denizzzka commented on August 24, 2024

...Honestly, I still did not understand the arguments against the use of Derelict.

(I made SFML2 wrapper for Derelict, it placed here: https://github.com/denizzzka/SFML2_wrapper )

from dsfml.

Jebbs avatar Jebbs commented on August 24, 2024

I can give you an example for what I mean as well as some other reasons why I don't use Derelict any longer with my binding.

Consider a SFML object with a destructor. Let's say CircleShape. You make a CircleShape object in your program, and then your program ends. If using Derelict, upon exit of the program the system tries to run GC to clean up any object, but for some reason you get an error that looks like "core.exception.InvalidMemoryOperationError." You got this error because the shared library is unloaded by the module destructor before the GC runs on exit of the program, so the sfCircleShape_destroy method no longer exists in memory to be used. When your program tries to call the function it produces the error. This will cause the CircleShape to stay in memory and never be freed. DSFML doesn't have this problem since the program links with the shared libraries statically.

Another reason I don't use Derelict is so that I don't require user to need Derelict in order to use DSFML. It should be a stand alone library.

Third, as I am making a new C back end to make the binding better I don't want to have to keep a version of Derelict up to date along with the C code AND the OO code. It would also be more work considering that one has to update the mangled names, then the function pointers, AND the code that loads and binds the two together.

Lastly, by mapping function pointers to functions in a shared library the way Derelict does creates some overhead when calling those functions. Sure it is a minimal amount, but when you want your game to be as fast as possible every little bit helps.

The only reason I can see one would want to use Derelict instead of creating a static binding would be the ease of loading the libraries since it does it automatically. Once you get the command line set for loading the shared libraries the way DSFML does it, you should never have to change that again so that argument is kind of moot.

Can you provide any arguments for why I should use Derelict?

from dsfml.

Jebbs avatar Jebbs commented on August 24, 2024

Just to clarify something, DSFML is a static binding, but that doesn't mean it uses static libraries. All versions use shared libraries since that is the only way to build them.

from dsfml.

denizzzka avatar denizzzka commented on August 24, 2024

I understand this point of view, thanks for the clarification. I think I really got excited.

from dsfml.

Jebbs avatar Jebbs commented on August 24, 2024

Hey, no worries. I'm pretty excited to! D is a cool new language and it deserves really cool game dev stuff. I just want to make sure it is designed well, the code is well managed, and it performs well, you know?

from dsfml.

denizzzka avatar denizzzka commented on August 24, 2024

I just need some simple graphics by simple way - I write a navigation program

from dsfml.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.