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

Author Topic: Using sfml-audio on Windows  (Read 6309 times)

0 Members and 2 Guests are viewing this topic.

Xwilarg

  • Newbie
  • *
  • Posts: 5
    • View Profile
    • Personal Website
    • Email
Using sfml-audio on Windows
« on: November 21, 2019, 02:29:38 am »
Hi,

I'm trying to use the SFML 2.5.1 on Windows and everything was working until I tried to use sfml audio.
When I'm trying to use sf::Music and I launch my program I have a segfault.

I already added openal32.dll next to my executable (I compiled the SFML on my computer to have it so it should be the right version).
I tried to launch my program on Visual Studio (2019) to have more information about it but I just got this:
Exception thrown at 0x00007FFD4023B40D (ntdll.dll) in RythmHero.exe: 0xC0000005: Access violation writing location 0x0000000000000008. occurred

Would someone please know how I could fix that?

Thanks in advance,

eXpl0it3r

  • SFML Team
  • Hero Member
  • *****
  • Posts: 11030
    • View Profile
    • development blog
    • Email
Re: Using sfml-audio on Windows
« Reply #1 on: November 21, 2019, 07:57:46 am »
Sounds like something isn't initialized. Can you provide a minimal example that reproduces the issue?
Official FAQ: https://www.sfml-dev.org/faq.php
Official Discord Server: https://discord.gg/nr4X7Fh
——————————————————————
Dev Blog: https://duerrenberger.dev/blog/

Xwilarg

  • Newbie
  • *
  • Posts: 5
    • View Profile
    • Personal Website
    • Email
Re: Using sfml-audio on Windows
« Reply #2 on: November 22, 2019, 05:37:40 pm »
Hi,

Sorry for the late reply, I created this small project to show the issue: https://github.com/Xwilarg/sfml-audio-bug
Just launch build.sh to build, then launch test.exe and it should crash.

eXpl0it3r

  • SFML Team
  • Hero Member
  • *****
  • Posts: 11030
    • View Profile
    • development blog
    • Email
Re: Using sfml-audio on Windows
« Reply #3 on: November 22, 2019, 06:08:50 pm »
You're using a static (and thus globally) initialized sf::Music, which is not allowed by SFML, as the initialization as well as the destruction order of global objects are undefined an since SFML too uses some globals to hide certain magic.
Official FAQ: https://www.sfml-dev.org/faq.php
Official Discord Server: https://discord.gg/nr4X7Fh
——————————————————————
Dev Blog: https://duerrenberger.dev/blog/

Xwilarg

  • Newbie
  • *
  • Posts: 5
    • View Profile
    • Personal Website
    • Email
Re: Using sfml-audio on Windows
« Reply #4 on: November 24, 2019, 10:49:14 am »
I'll change that then, thanks for your help

 

anything