SDL/win32 incompatible with fprintf(stderr,...) atexit?

The title more or less gives my question away. I am trying to use SDL with
another library, which is in the habit of fprintf’ing to stderr as part of
the atexit functionality. Well, I think it might be part of a destructor in
a globally declared class, but whatever.

The program crashes inside the call to fprintf. I thought perhaps this might
be due to SDLMain, and its habit of creating a stderr.txt for me, and then
closing it later on. Otherwise the problem is something much more ominous.
Does this diagnosis sound likely? If so, can anyone think of any way
whatsoever to provide a stderr for this other library?

-Thomas

just off the top of my head, perhaps fprintf is dying when part of what its
printing is causing some kinda page fault or something…IE:

fprintf(“Error bad value for blah: %s”,GetBlahValue());

something like that where due to mem corruption or something, the function
is crashing.

::shrug::> ----- Original Message -----

From: thomasharte[at@]lycos.co.[united kingdom] (Thomas Harte)
Newsgroups: loki.open-source.sdl
To:
Sent: Saturday, September 21, 2002 1:04 PM
Subject: [SDL] SDL/win32 incompatible with fprintf(stderr,…) atexit?

The title more or less gives my question away. I am trying to use SDL with
another library, which is in the habit of fprintf’ing to stderr as part of
the atexit functionality. Well, I think it might be part of a destructor
in
a globally declared class, but whatever.

The program crashes inside the call to fprintf. I thought perhaps this
might
be due to SDLMain, and its habit of creating a stderr.txt for me, and then
closing it later on. Otherwise the problem is something much more ominous.
Does this diagnosis sound likely? If so, can anyone think of any way
whatsoever to provide a stderr for this other library?

-Thomas


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

Hiya,

If the destructor calls fprintf() after you’ve called SDL_Quit() then
you may get this behavior. You should delete your objects before the
end of the program anyway instead of expecting the program to clean up
after itself - it’s good programming practice to deallocate any memory
you allocate.

Neil.

Saturday, September 21, 2002, 9:04:26 PM, you wrote:

TH> The title more or less gives my question away. I am trying to use SDL with
TH> another library, which is in the habit of fprintf’ing to stderr as part of
TH> the atexit functionality. Well, I think it might be part of a destructor in
TH> a globally declared class, but whatever.

TH> The program crashes inside the call to fprintf. I thought perhaps this might
TH> be due to SDLMain, and its habit of creating a stderr.txt for me, and then
TH> closing it later on. Otherwise the problem is something much more ominous.
TH> Does this diagnosis sound likely? If so, can anyone think of any way
TH> whatsoever to provide a stderr for this other library?

TH> -Thomas

TH> _______________________________________________
TH> SDL mailing list
TH> SDL at libsdl.org
TH> http://www.libsdl.org/mailman/listinfo/sdl--
Best regards,
Neil mailto:n.griffiths at virgin.net

If the destructor calls fprintf() after you’ve called SDL_Quit() then
you may get this behavior. You should delete your objects before the
end of the program anyway instead of expecting the program to clean up
after itself - it’s good programming practice to deallocate any memory
you allocate.

As I say, this is not something I am doing, but is a feature of a library to
which I am linking. However it is GPL, so I will be able to fix this.
Thanks!

-Thomas

At 04:24 PM 9/22/02 +0100, you wrote:

.

As I say, this is not something I am doing, but is a feature of a library to
which I am linking. However it is GPL, so I will be able to fix this.
Thanks!

You tried --disable-stdio-redirect on a SDL compile?–
Majromax (113/24)

I also had this behavior under win32 using MSVC. The linker wasn’t using the
proper .lib files.
To fix this i had to setup my VC project so that it only uses ‘Multithreaded
DLL’ as runtime library. (project > settings > C/C++ tab > category = ‘Code
Generation’ > Use Run-tiem libary = Multithreaded DLL)

hope that helps.

Alx

“Thomas Harte” <ThomasHarte[at@]lycos.co.[united kingdom]> a ?crit dans le
message de news: amij8g$1f1t$1 at hoth.stenstad.net

The title more or less gives my question away. I am trying to use SDL with
another library, which is in the habit of fprintf’ing to stderr as part of
the atexit functionality. Well, I think it might be part of a destructor
in
a globally declared class, but whatever.

The program crashes inside the call to fprintf. I thought perhaps this
might> be due to SDLMain, and its habit of creating a stderr.txt for me, and then
closing it later on. Otherwise the problem is something much more ominous.
Does this diagnosis sound likely? If so, can anyone think of any way
whatsoever to provide a stderr for this other library?

-Thomas