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

Author Topic: Dynamic Linking on Windows  (Read 9046 times)

0 Members and 1 Guest are viewing this topic.

Tahsin13

  • Newbie
  • *
  • Posts: 1
    • View Profile
Dynamic Linking on Windows
« on: October 07, 2021, 06:05:33 am »
Hi all,

I'm trying to get SFML working with dynamic linking on Windows. Currently I just use Visual Studio to copy the dll files in a post build event. However, I want to switch to CMake and get real dynamic linking working. I've been trying to add the SFML dlls to my system. I copied all the dll files to C:\Windows\SysWOW64, and tried using the regsvr32 command from this directory to register my dlls. I'm assuming that SFML is 32 bit. However, I get that DLLRegisterServer not defined. Apparently this is a function that has to be in all dlls for them to be registerable. Is this function just not defined in SFML? If so what's the point of using dynamic linking with SFML? If I have to copy the dlls to my bin directory anyway, am I not using a different dll for every instance? Doesn't that defeat the entire point of dlls?

Laurent

  • Administrator
  • Hero Member
  • *****
  • Posts: 32498
    • View Profile
    • SFML's website
    • Email
Re: Dynamic Linking on Windows
« Reply #1 on: October 07, 2021, 08:04:46 am »
Hi

regsvr32 is for a very specific purpose (ActiveX controls if I remember correctly). You don't have to use it to register your DLLs, they just have to be in a folder that's in the PATH environment variable.
Laurent Gomila - SFML developer

eXpl0it3r

  • SFML Team
  • Hero Member
  • *****
  • Posts: 11038
    • View Profile
    • development blog
    • Email
Re: Dynamic Linking on Windows
« Reply #2 on: October 10, 2021, 06:12:07 pm »
SFML can either be 32-bits or 64-bits it depends what you downloaded/built.

I think most developers have given up with "sharing" DLLs across multiple applications, unless it's something very widely used, like the .NET runtime, see also DLL Hell.
But DLLs can still have their use cases, when you have multiple libraries/applications as part of your software (e.g. client & server).

Personally, I always go with static libraries on Windows, but those will have their own things to consider.
Official FAQ: https://www.sfml-dev.org/faq.php
Official Discord Server: https://discord.gg/nr4X7Fh
——————————————————————
Dev Blog: https://duerrenberger.dev/blog/