3

I'm developing a program using SDL2 (and all the extension libraries). One of those libraries is, of course, SDL_Mixer v2.0.2.

With SDL_Mixer, all of the examples and tutorials use the Mix_Init function (along with a subsequent Mix_Quit at the end of the program). From my understanding, this loads the dynamic libraries such as ogg, mpg123, etc. However, I have statically linked all the libraries into the executable (both SDL_Mixer and all the audio libraries).

Does this mean I do not need to call Mix_Init? I ask this because the function always returns the incorrect flags (which means it failed to load). Even if it fails, or I don't even call it to begin with, I'm still able to play .mp3, .flac, and all the other audio formats.

Since it appears to work fine without it, I want to go without calling the function at all. At the same time though, I want to be sure what I'm doing is how its supposed to be handled and there's not some actual unhanded error that is resulting in memory leaks or whatever.

Griffort
  • 1,174
  • 1
  • 10
  • 26
  • 1
    You can inspect the implementation of `Mix_Init` and check if it does anything else in addition to loading dynamic libraries. – HolyBlackCat Sep 01 '18 at 21:39
  • @HolyBlackCat Trust me, I did, but the entire thing went over my head. Didn’t really understand where some things were coming from, etc... – Griffort Sep 01 '18 at 22:04

1 Answers1

0

Does this mean I do not need to call Mix_Init?

I wouldn't do that and continue to call Mix_Init instead.

One of those libraries is, of course, SDL_Mixer v2.0.2. [...] I ask this because the function always returns the incorrect flags (which means it failed to load)

Unfortunately, it is a known bug of SDL Mixer v2.0.2 and I had a lot of troubles before to realize it a while ago.
The error is quite clear and it's another way of saying that Mix_Init returns incorrect flags:

Mix_Init always returns 0 - no supported music interfaces found

In fact, it doesn't mean that it failed to load something and you noticed it for yourself:

Even if it fails, or I don't even call it to begin with, I'm still able to play .mp3, .flac, and all the other audio formats.

skypjack
  • 49,335
  • 19
  • 95
  • 187