PocketMatrix forums

A read-only archive of the PocketMatrix forums (2001–2014). Posting and accounts are closed.

Errors with Mikmod!

Hi all, I'm just about finshed Squish3, and decided to compile a release version, anyhow the file still looked too big, so I "clicked" on to the fact that the mikmod Lib was compiled in debug mode as well, so I re-compiled it, all went well, then re-compiled my game (less 100k) "cool"! but now my music dont work!, with my error handling code I traced it down to this section:
Code:

if (song == 1)
{
music = Player_Load(fullpath(SONG1),8,0); //main menu
if (music == 0) error("Player load 1",screen_buffer_p);
}


If seems that it cant "find" the song any more, ehh?, the fullpath func is an easyce lib, and before the re-compile of mikmod this code worked fine.... any ideas? I tried placing the file in the root of the device etc, just to see what would happen, nothing..... still get the error! I also removed the fulpath func (by default it should then assume the root)... but failed.... anyhow Ideas?

-Brendan
brendan · 05 Sep 2002, 01:25 UTC — Ummm, more info...
It would seem, that it is not an error opening the file, the following gets the pointer ok:

Code:

if (song == 1)
{
fp = fopen(fullpath("M1.dat"),"rb");
if (fp)
{
music = Player_LoadFP(fp,8,0); //main menu
fclose(fp);
}
else error("Cant Open 1",screen_buffer_p);
if (music == 0) error("Player load 1",screen_buffer_p);
}


which means its stuffing up somewhere else!

BTW I can still play samples ok, just not music...

-Brendan
There are typically 5 reasons a Release build will not work when a Debug build will:

A variable is not being initialized (all vars are initialized to 0 in debug builds automatically).

An array is being written to out of bounds. In debug builds arrays have extra padding at each end, which can keep bad things from happening if that memory is written to.

Compiler Optimizations. I have seen several, if not a dozen or more, instances where the compiler's optimizer created buggy code (for every processor type, even x86 with VC++). Try turning off optimizations for the Release build. If that fixes the problem, then zero in on the specific source file, then the actual function. You can use pragma directives to disable optimization of a specific function.

Compiler / Link settings. The Debug and Release settings are completely independant of one another. Some programmers set defines in the compiler parameters, such as "_PC_" if the build is for a PC version. If a define is missing / incorrect in the Release settings then it could trigger the use of the wrong block of code. For example, an ANSI version of code may be used in the Release build instead of the UNICODE version because of a missing compiler definition in the settings.

Multithreading. Applications that use multiple threads must be very careful regarding access of shared data, etc. Threading issues can manifest in very bizzare ways. It is certainly possible that a Release build will exhibit bugs that a Debug version may not because the execution time of the various routines is different because of compiler optimizations.

Dan East