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

Author Topic: SFML With no DLLS?  (Read 9753 times)

0 Members and 2 Guests are viewing this topic.

kneksacke

  • Newbie
  • *
  • Posts: 11
    • View Profile
SFML With no DLLS?
« on: February 21, 2017, 07:34:05 pm »
When i make a small program and i want to send it to a friend or upload it i must include all the DLLs in a rar file. i just want a nice and simple .EXE file with no DLLs. (Well at least not send them)
i made a few games with Game maker studio and with that program you can
export just a single EXE file, really handy.
how do they do it?
they even pack the Textures inside the EXE.

what if someone just wants the game on their desktop. they would have to create a shortcut or put all the DLLs on their desktop. not really user friendly.
« Last Edit: February 21, 2017, 07:38:00 pm by kneksacke »

Rosme

  • Full Member
  • ***
  • Posts: 169
  • Proud member of the shoe club
    • View Profile
    • Code-Concept
Re: SFML With no DLLS?
« Reply #1 on: February 21, 2017, 08:28:06 pm »
To not have any DLL, you can link statically. But if you use audio, you will have to provide OpenAL DLL nonetheless. As for embedding the resources into the executable, you can take a look at how resources files works.

And to have all in a folder, and just a shortcut is rather standard. You can also easily update any file that is not your executable that way.
GitHub
Code Concept
Twitter
Rosme on IRC/Discord

StubblyOne

  • Newbie
  • *
  • Posts: 7
    • View Profile
    • Email
Re: SFML With no DLLS?
« Reply #2 on: February 22, 2017, 03:26:03 am »
It sounds as if you need to create an msi installer. You can use something like wix or installshield to create the installer.

Wix is probably your best bet as its free and very simple to use. If you have worked with xml you will get the hang of it in no time.

Edit: forget statically linking it bloats the exe. Just package everything in the installer
« Last Edit: February 22, 2017, 03:27:38 am by StubblyOne »

kneksacke

  • Newbie
  • *
  • Posts: 11
    • View Profile
Re: SFML With no DLLS?
« Reply #3 on: February 22, 2017, 07:11:00 pm »
It sounds as if you need to create an msi installer. You can use something like wix or installshield to create the installer.

Wix is probably your best bet as its free and very simple to use. If you have worked with xml you will get the hang of it in no time.

Edit: forget statically linking it bloats the exe. Just package everything in the installer


I dont care about file size or slower run time.  my programs are very small in the first place.

barnack

  • Jr. Member
  • **
  • Posts: 56
    • View Profile
Re: SFML With no DLLS?
« Reply #4 on: October 26, 2017, 12:57:51 am »
When i make a small program and i want to send it to a friend or upload it i must include all the DLLs in a rar file. i just want a nice and simple .EXE file with no DLLs. (Well at least not send them)
i made a few games with Game maker studio and with that program you can
export just a single EXE file, really handy.
how do they do it?
they even pack the Textures inside the EXE.

what if someone just wants the game on their desktop. they would have to create a shortcut or put all the DLLs on their desktop. not really user friendly.

So you mean 99.99% of the games around are not user friendly? Since they all install inside a folder, with resources and stuff, and then add a shortcut in your desktop. You know, there's a folder called "program files" kindly delivered to you by Microsoft itself, which is there right for you to put your game folder with all its content ;)

Well unless you're using Linux. Linux is a real mess regarding where programs files are put. They appear not to follow any convention or standard (aside from using 3 characters folders which purpose cannot be easily understood), which is just a reason more not to use Linux.

A quick google search can help you finding how to create an installer for your program. Also note, Game Maker Studio specifies the "exe only export" as a kind of optional "fast tool". The regular game maker export for Windows does actually automatically generate for you a Windows installer for your program, which will, not surprisingly, extract your files in the install folder.
« Last Edit: October 26, 2017, 01:01:36 am by barnack »

Kerachi

  • Newbie
  • *
  • Posts: 18
    • View Profile
    • Email
Re: SFML With no DLLS?
« Reply #5 on: November 27, 2017, 10:07:49 am »
Game Maker Studio can archive your game files into one exe file and run it properly, because Game Maker uses (as far as I know) Java, C and C++ dll-s, and those dll-s was already installed on most of the computers.

But if you have no installed Java (JRE,JDK), and or C++ Runtime Redistributable, then I assume those Game Maker exe-s won't work.

If you manage somehow to install all the sfml dll-s on every computer, then sfml could do the same thing easily.
« Last Edit: November 27, 2017, 10:09:44 am by Kerachi »

FRex

  • Hero Member
  • *****
  • Posts: 1848
  • Back to C++ gamedev with SFML in May 2023
    • View Profile
    • Email
Re: SFML With no DLLS?
« Reply #6 on: November 27, 2017, 03:25:44 pm »
They do not depend on any specially installed dlls. They are statically linked and rely only on the OS provided dlls (like kernel32.dll, user32.dll - these are always present on Windows because they are for accessing components of Windows itself) which you can verify yourself with things like dumpbin /imports.

Installing SFML dlls everywhere would also be impossible on Windows because there are so many different and incompatible compiler set ups. That's why Windows programs usually come with their own dlls of everything (i.e. I have like 5 libgtk.dll files in 5 different apps) near the exe, link statically or come with bundled Microsoft redistributable C or DX or .NET runtime installer in their own installer (I've seen many games do that).

You can also link your C or C++ statically (on Windows) without a problem (except legal ones like OpenAL and others LGPL licensing) and it's described in the tutorials too. Rust and Free Pascal (among others) similarly link statically by default so there are no dlls and the exe is self contained.

Bundling resources into an exe is a separate issue and the best (IMO) way is to append the archive to the exe itself and then somehow access it from inside the exe (specifics vary and are up to you). Due to how the exe format works and parses the exe using the PE header it will just ignore the part that you append yourself, never even touching it. There are other ways but I don't know much about them and they seem more complicated in comparison.

These are also not hard rules and you can dynamically link (or even runtime link) in Free Pascal and Rust, and some Game Maker games come with pack files or loose files and own dlls that the exe requires too.

I'm also not aware of anything related to Java in Game Maker Studio (I thought it's Delphi Pascal and/or C/C++ in the tool itself plus their own scripting language for game scripting) and relying on Java being present is a big if. Many Java applications bundle their own JDK/JRE in installer due to that. I'm pretty sure Minecraft and KNime do.
Back to C++ gamedev with SFML in May 2023