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

Author Topic: Why is SFML split with 1 dll file per module?  (Read 8531 times)

0 Members and 1 Guest are viewing this topic.

Ceylo

  • Hero Member
  • *****
  • Posts: 2325
    • View Profile
    • http://sfemovie.yalir.org/
    • Email
Why is SFML split with 1 dll file per module?
« on: January 04, 2018, 10:16:56 pm »
Hello,

I’m wondering why each SFML module is represented by a distinct dynamic library file? Rather than a single SFML.dll.
I understand the semantic separation by related features, but this only requires separation by modules in documentation and in the API. When doing a new release, all modules are shipped together with the newer version, there is no independent versionning. Also all the modules account for less than 2.5MB so I see no need to sometimes ship only part of SFML for lighter distribution. This makes linking against SFML uselessly "complicated" (it’s quite simple already actually but could be simpler), and makes the project structure for SFML developers also more complicated than necessary.

So I’m wondering... why the split in several library files ?
Want to play movies in your SFML application? Check out sfeMovie!

eXpl0it3r

  • SFML Team
  • Hero Member
  • *****
  • Posts: 11030
    • View Profile
    • development blog
    • Email
Re: Why is SFML split with 1 dll file per module?
« Reply #1 on: January 04, 2018, 10:46:09 pm »
Because not everyone needs all the modules all the time. 80% of the SFML projects probably never use the network module.

What's the real downside of having it split "physically"? Is linking or shipping one library really that that much simpler?
Official FAQ: https://www.sfml-dev.org/faq.php
Official Discord Server: https://discord.gg/nr4X7Fh
——————————————————————
Dev Blog: https://duerrenberger.dev/blog/

Ceylo

  • Hero Member
  • *****
  • Posts: 2325
    • View Profile
    • http://sfemovie.yalir.org/
    • Email
Re: Why is SFML split with 1 dll file per module?
« Reply #2 on: January 04, 2018, 11:53:12 pm »
Because not everyone needs all the modules all the time. 80% of the SFML projects probably never use the network module.
So ? It doesn’t matter if you don’t use everything and have everything for the same price. What’s the advantage in having minimalist binaries when the whole package is 2.5MB?

What's the real downside of having it split "physically"? Is linking or shipping one library really that that much simpler?
More complicated than needed. Why care about which module you link against? Why should you need to care about the link order? Why should your app need to have 5 or 6 dynamic library files installed or shipped (for systems that favor dynamic libs) when it actually depends on a single API?
Want to play movies in your SFML application? Check out sfeMovie!

Laurent

  • Administrator
  • Hero Member
  • *****
  • Posts: 32498
    • View Profile
    • SFML's website
    • Email
Re: Why is SFML split with 1 dll file per module?
« Reply #3 on: January 05, 2018, 07:57:53 am »
Don't forget that a SFML module is not just a shared library, it also brings with it a bunch of system dependencies. Maybe some people don't want to install all the audio libs if they don't use audio (there's even a request to add options to disable codecs within the audio library, to reduce the amount of dependencies to what's strictly needed). Or maybe people simply can't compile the graphics module because they have no display (and thus no X & GL libs), but they don't care since they only use audio and network.
Laurent Gomila - SFML developer

Ceylo

  • Hero Member
  • *****
  • Posts: 2325
    • View Profile
    • http://sfemovie.yalir.org/
    • Email
Re: Why is SFML split with 1 dll file per module?
« Reply #4 on: January 05, 2018, 10:05:02 am »
Don't forget that a SFML module is not just a shared library, it also brings with it a bunch of system dependencies. Maybe some people don't want to install all the audio libs if they don't use audio (there's even a request to add options to disable codecs within the audio library, to reduce the amount of dependencies to what's strictly needed). Or maybe people simply can't compile the graphics module because they have no display (and thus no X & GL libs), but they don't care since they only use audio and network.
Ok indeed. Do you know the percentage of users that want to use only some parts of SFML? Especially how many don’t want audio or graphics/window, since this is where there are most dependencies?
Want to play movies in your SFML application? Check out sfeMovie!

Laurent

  • Administrator
  • Hero Member
  • *****
  • Posts: 32498
    • View Profile
    • SFML's website
    • Email
Re: Why is SFML split with 1 dll file per module?
« Reply #5 on: January 05, 2018, 10:15:54 am »
I have no idea, probably not that much. But definitely not zero.
Laurent Gomila - SFML developer

eXpl0it3r

  • SFML Team
  • Hero Member
  • *****
  • Posts: 11030
    • View Profile
    • development blog
    • Email
Re: Why is SFML split with 1 dll file per module?
« Reply #6 on: January 05, 2018, 12:15:18 pm »
To some extend it certainly also comes down to personal preference. I mean, why a shared library at all, why not header-only? ;)

Fact is, that only with a modular library you can pick and choose the feature set and connected dependencies you need.

C++ library linking situation simply isn't that great as other languages dependency management. This affects us as much as any other library out there. People having trouble linking one or multiple libraries isn't really a problem SFML should try to "solve", because it's not that this is a complex thing, but it's just something you have to learn when working with C++, yet a large percentage of SFML user have little to none C++/programming experience. We shouldn't base our decisions around that group of people.

Also not forget, with a monolithic SFML library, you'll also have to always ship the OpenAL.dll (on Windows) regardless whether you use SFML's audio part or not. And as Laurent mentioned, you wouldn't be able to run SFML on a headless setup.
Official FAQ: https://www.sfml-dev.org/faq.php
Official Discord Server: https://discord.gg/nr4X7Fh
——————————————————————
Dev Blog: https://duerrenberger.dev/blog/

Phanoo

  • Full Member
  • ***
  • Posts: 136
    • View Profile
Re: Why is SFML split with 1 dll file per module?
« Reply #7 on: January 05, 2018, 06:18:13 pm »
I think the argument to split SFML in several DLLs to lower the global project size if a module isn't needed is not very realistic, since if you really care about size, you just statically link.

ratzlaff

  • Newbie
  • *
  • Posts: 33
    • View Profile
Re: Why is SFML split with 1 dll file per module?
« Reply #8 on: January 08, 2018, 04:28:42 pm »
Just the ability to build as separate dll's is an indication of good design. There are clear dependencies between modules and you do not have to build 'everything' just to get something working.

FRex

  • Hero Member
  • *****
  • Posts: 1848
  • Back to C++ gamedev with SFML in May 2023
    • View Profile
    • Email
Re: Why is SFML split with 1 dll file per module?
« Reply #9 on: January 15, 2018, 06:30:01 am »
I'm usually on the side of simplicity but not here.

System is common stuff and it can't be duplicated if other libs are split, Audio makes sense to be split out to not force people to bring in OpenAL if they don't want audio or the rest if they do (i.e. I'd use SFML audio if I was using Irrlicht for 3D), Network is hardly stellar (I never used it personally..) and Window makes sense to be split out (for pure GL and input).

Maybe a Graphics and Graphics-and-Audio dll targets could be made (I'm kinda biased against Network) but if you really care about this then you just link statically.
« Last Edit: January 15, 2018, 06:32:32 am by FRex »
Back to C++ gamedev with SFML in May 2023

Mario

  • SFML Team
  • Hero Member
  • *****
  • Posts: 879
    • View Profile
Re: Why is SFML split with 1 dll file per module?
« Reply #10 on: January 18, 2018, 09:06:43 am »
Don't forget that SFML is not licensed under LGPL, so it has no licensing effect on your project no matter how you use it. You're not forced to use the shared library version. If you want something monolithic, you can just build or use the static version of SFML, either in your own library or right with the executable.

Sub

  • Full Member
  • ***
  • Posts: 159
    • View Profile
Re: Why is SFML split with 1 dll file per module?
« Reply #11 on: January 19, 2018, 10:56:18 pm »
Splitting it has benefits which have already been mentioned in this thread.  For me personally, it's never been the source of difficulty or inconvenience, and I didn't exactly have a lot of experience in programming when I first started using SFML.

Hapax

  • Hero Member
  • *****
  • Posts: 3379
  • My number of posts is shown in hexadecimal.
    • View Profile
    • Links
Re: Why is SFML split with 1 dll file per module?
« Reply #12 on: January 27, 2018, 11:06:29 pm »
Sometimes, you might just want the audio section so needing to link the whole Graphics package with its dependencies seems a bit like overkill.
Selba Ward -SFML drawables
Cheese Map -Drawable Layered Tile Map
Kairos -Timing Library
Grambol
 *Hapaxia Links*

Alia5

  • Newbie
  • *
  • Posts: 34
    • View Profile
Re: Why is SFML split with 1 dll file per module?
« Reply #13 on: February 27, 2018, 10:12:43 am »
If you really want to have a single lib, build SFML static, and link all the libs together into a single SFML.lib ( || SFML.a)
You do this **once**, after that you have exactly what you want.

aggsol

  • Newbie
  • *
  • Posts: 24
  • C++
    • View Profile
    • My Github Account
Re: Why is SFML split with 1 dll file per module?
« Reply #14 on: March 21, 2018, 08:50:50 am »
Just the ability to build as separate dll's is an indication of good design. There are clear dependencies between modules and you do not have to build 'everything' just to get something working.

This is indeed a good argument because it shows that encapsualtion is done right with SFML.