Win32/Linux SDL Differences

Hello,
I’ve been developing an application in Linux for some time now and it
runs very well and very stable in Linux, but I get seemingly random
crashes in the Win32 build. Are there any differences in the SDL
implementation for Linux and for Win32 that would cause such a thing or
am I incorrectly using SDL?

Thanks ahead of time for any help.

– chris (@Christopher_Thielen)

I’ve been developing an application in Linux for some time now and it
runs very well and very stable in Linux, but I get seemingly random
crashes in the Win32 build. Are there any differences in the SDL
implementation for Linux and for Win32 that would cause such a thing or
am I incorrectly using SDL?

I’ve had similar problems, however it’s the reverse. The win32 build works
perfectly, and Linux/MacOS faults. ;-( So far I have not been able to
prove this to be a problem of SDL, but rather of my code. So far it has
been because of lack of error checking when dealing with SDL. Double check
those errors! IIRC, There’s a way to prevent SDL from trapping faults and
shutting down which might yield a backtrace that’s useful.

And let’s not talk about how bad it is going from DOS to any real OS. That
was a painful experience.

–>Neil-------------------------------------------------------------------------------
Neil Bradley What are burger lovers saying
Synthcom Systems, Inc. about the new BK Back Porch Griller?
ICQ #29402898 “It tastes like it came off the back porch.” - Me

Chris Thielen wrote:

Hello,
I’ve been developing an application in Linux for some time now and it
runs very well and very stable in Linux, but I get seemingly random
crashes in the Win32 build. Are there any differences in the SDL
implementation for Linux and for Win32 that would cause such a thing

Yes.
It cantains:
" #include <windows.h> "
Hehe… :slight_smile:

(but seriously, I’m using SDL on Windows and it works just fine, and
also use some programs written with SDL specifically for Linux, and they
work perfectly when compiled for windows…)

or am I incorrectly using SDL?

That could be answered if you’ll say how are you using SDL…

RK.>

Thanks ahead of time for any help.

– chris (chris at luethy.net)

There might be a difference in that you get HW surfaces in windows. If
you access the pixel data directly and forget to lock the surfaces
this leads to crashes and worse… You can also lose HW surfaces (see
the return code of SDL_BlitSurface()) when you switch between windowed
and fullscreen mode for example.

Also windows (at least win 98) seems a bit more sensitive if you don’t
process events correctly in SDL.
Another difference may be how the OS/libraries/compiler handle illegal
memory access. You can use the electric fence library on linux to
catch a lot of these errors, and is probably some equivalent tool on
windows.

–ulf-------------------

Hello,
I’ve been developing an application in Linux for some time now and
it
runs very well and very stable in Linux, but I get seemingly random
crashes in the Win32 build. Are there any differences in the SDL
implementation for Linux and for Win32 that would cause such a thing
or
am I incorrectly using SDL?

Thanks ahead of time for any help.

– chris (chris at luethy.net)

Well, yea, I’m guessing maybe I’m doing something wrong, as I know SDL
works great in Win32. My code is GPL and the Win32 version (msvc
workspace files and such) is at
http://prdownloads.sourceforge.net/epiar/epiar_0_18_src.zip?download

I don’t know what I’m doing wrong, as the Linux version runs great. Any
help would be greatly appreciated.

– chris (@Christopher_Thielen)On Fri, 2002-07-12 at 15:44, Romi Kuntsman wrote:

Chris Thielen wrote:

Hello,
I’ve been developing an application in Linux for some time now and it
runs very well and very stable in Linux, but I get seemingly random
crashes in the Win32 build. Are there any differences in the SDL
implementation for Linux and for Win32 that would cause such a thing

Yes.
It cantains:
" #include <windows.h> "
Hehe… :slight_smile:

(but seriously, I’m using SDL on Windows and it works just fine, and
also use some programs written with SDL specifically for Linux, and they
work perfectly when compiled for windows…)

or am I incorrectly using SDL?

That could be answered if you’ll say how are you using SDL…

RK.

Thanks ahead of time for any help.

– chris (@Christopher_Thielen)

And let’s not talk about how bad it is going from DOS to any real OS. That
was a painful experience.

True THAT.

As for crashes across OSes; based on malloc() behaviour and basic memory
layout, a buggy program can work perfectly on Linux and crash on win32
(and vice versa). This is not uncommon! Use ElectricFence and such and
find buffer overflows.

–ryan.

I’m pretty sure you just did some mistakes with freeing memories.
Win32 apps tend to ignore errors. So even if you double free a memory
area, the app keeps running. This is not a good thing, since the app wil
crash later, at a random point, which makes it harder to detect where
the mistake is.
But in Linux, apps don’t ignore errors (at least not as much as Win32
apps), so they crash immediately.
You should check your source code for errors like that.On Fri, 2002-07-12 at 23:53, Neil Bradley wrote:

I’ve had similar problems, however it’s the reverse. The win32 build works
perfectly, and Linux/MacOS faults. ;-(

I’ve had similar problems, however it’s the reverse. The win32 build works
perfectly, and Linux/MacOS faults. ;-(
I’m pretty sure you just did some mistakes with freeing memories.

Nope. I’m trashing memory - I know it. I have memory wrappers for all
allocations, and it has prefix/suffix markers on all allocated blocks in
debug mode. It tells me I’ve hashed memory, so I know what’s happening in
debug mode. :wink:

Win32 apps tend to ignore errors. So even if you double free a memory
area, the app keeps running.

I have wrappers on all of my malloc/frees that will null out a pointer
when I free, and assert they are null when I allocate.

But in Linux, apps don’t ignore errors (at least not as much as Win32
apps), so they crash immediately.

I’ve seen it both ways. There are many errors our Linux port didn’t catch
but Win32 did, and the reverse is also true. They weren’t better or worse

  • they were just different. It just depends upon how picky the heap
    managers are, and by what method RAM was allocated. In my case, it’s 100%
    mallocs, so the problem is not related to the OS, but rather to the local
    heap management linked in with the code itself.

–>Neil-------------------------------------------------------------------------------
Neil Bradley What are burger lovers saying
Synthcom Systems, Inc. about the new BK Back Porch Griller?
ICQ #29402898 “It tastes like it came off the back porch.” - Me

yea, i’m still not entirely sure what my problem is on the win32
version. i think it probably goes both ways w/ the memory
management. win32 seems to do the crashing while linux is stable,
whereas it was mentioned to be the other way.

anyway, hopefully turning off the parachute and backtracing might help,
but i wont have access to a win32 box for a few more days. (yes, there
are places in the world where you cant find a computer running
windows)

– chris (@Christopher_Thielen)On Fri, 2002-07-12 at 18:06, Neil Bradley wrote:

I’ve had similar problems, however it’s the reverse. The win32 build works
perfectly, and Linux/MacOS faults. ;-(
I’m pretty sure you just did some mistakes with freeing memories.

Nope. I’m trashing memory - I know it. I have memory wrappers for all
allocations, and it has prefix/suffix markers on all allocated blocks in
debug mode. It tells me I’ve hashed memory, so I know what’s happening in
debug mode. :wink:

Win32 apps tend to ignore errors. So even if you double free a memory
area, the app keeps running.

I have wrappers on all of my malloc/frees that will null out a pointer
when I free, and assert they are null when I allocate.

But in Linux, apps don’t ignore errors (at least not as much as Win32
apps), so they crash immediately.

I’ve seen it both ways. There are many errors our Linux port didn’t catch
but Win32 did, and the reverse is also true. They weren’t better or worse

  • they were just different. It just depends upon how picky the heap
    managers are, and by what method RAM was allocated. In my case, it’s 100%
    mallocs, so the problem is not related to the OS, but rather to the local
    heap management linked in with the code itself.

–>Neil


Neil Bradley What are burger lovers saying
Synthcom Systems, Inc. about the new BK Back Porch Griller?
ICQ #29402898 “It tastes like it came off the back porch.” - Me


SDL mailing list
SDL at libsdl.org
http://www.libsdl.org/mailman/listinfo/sdl

Hi

I had pretty much the same scenario here - an app working fine in Win32 but
Segfaults galore in Linux.

Rebuilding the app in debug mode and linking with electric fence (Debian
package is “efence”) highlighted quite a few silly little problems.

It is - in fact - surprising that it ran on Win32 at all!

Steve> ----- Original Message -----

From: Neil Bradley [mailto:nb@synthcom.com]
Sent: 12 July 2002 22:54
To: sdl at libsdl.org
Subject: Re: [SDL] Win32/Linux SDL Differences

I've been developing an application in Linux for some time now and

it

runs very well and very stable in Linux, but I get seemingly random
crashes in the Win32 build. Are there any differences in the SDL
implementation for Linux and for Win32 that would cause such a thing or
am I incorrectly using SDL?

I’ve had similar problems, however it’s the reverse. The win32 build works
perfectly, and Linux/MacOS faults. ;-( So far I have not been able to
prove this to be a problem of SDL, but rather of my code. So far it has
been because of lack of error checking when dealing with SDL. Double check
those errors! IIRC, There’s a way to prevent SDL from trapping faults and
shutting down which might yield a backtrace that’s useful.

And let’s not talk about how bad it is going from DOS to any real OS. That
was a painful experience.

–>Neil



Neil Bradley What are burger lovers saying
Synthcom Systems, Inc. about the new BK Back Porch Griller?
ICQ #29402898 “It tastes like it came off the back porch.” - Me


SDL mailing list
SDL at libsdl.org
http://www.libsdl.org/mailman/listinfo/sdl


This email and any files transmitted with it are confidential and
intended solely for the use of the individual or entity to whom they
are addressed. If you have received this email in error please notify
the system manager.

This footnote also confirms that this email message has been swept by
MIMEsweeper for the presence of computer viruses.

www.mimesweeper.com