SDL-1.2 RWOps under Win32 (VS 8) is it working or?

Hi,

I am running into some problems trying to make RWOps work in my own
project…
So I tried to run a basic tutorial only using SDL and not my stuff.

I got some problems trying to run this :
http://www.kekkai.org/roger/sdl/rwops/rwtut1.c
It just fails during the SDL_LoadBMP_RW but down in some windows dlls…

I tried with both the release SDL 1.2.9 and the last SDL-1.2 CVS snapshot…
using VS Express 8 (2005)

I was wondering if someone already experienced the same thing, and if
someone might have some clues…
Or maybe there is something I am doing that I shouldnt ??
In which version of SDL are the RWOps known to be fully working or not on
win32 ??

Thanks for your help,

Cheers,

I think SDL_RWFromFP(file, 0); is not fully safe on Win32 at least.

It depends on :

  • the compilation model (for MSVCRT - multithreaded dll ? or LIBCMT.LIB : static lib c multithreaded, or LIBC.LIB : static lib C monothread etc) of your own project.
  • the compilation model of the SDL.dll

You have to use exactly the same libC than the SDL.DLL for this function to work properly.

the argument FILE *file is simply passed from your code to the dll, and then to the “libc” version of the dll, but it has been created in your code, with your own version of “libc”. If they are not the same, this will not work correctly.

You could do SDL_RWFromFile(const char *filename, etc); instead of opening the file yourself, this would hopefully work.

or , open the file yourself, load it in memory (or map it to memory) and then SDL_RWFromMem() on a pointer to data loaded (or mapped).

Asmodehn Shade a ?crit :> Hi,

I am running into some problems trying to make RWOps work in my own
project…
So I tried to run a basic tutorial only using SDL and not my stuff.

I got some problems trying to run this :
http://www.kekkai.org/roger/sdl/rwops/rwtut1.c
It just fails during the SDL_LoadBMP_RW but down in some windows dlls…

I tried with both the release SDL 1.2.9 and the last SDL-1.2 CVS
snapshot… using VS Express 8 (2005)

I was wondering if someone already experienced the same thing, and if
someone might have some clues…
Or maybe there is something I am doing that I shouldnt ??
In which version of SDL are the RWOps known to be fully working or not
on win32 ??

Thanks for your help,

Cheers,



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

It depends on :

  • the compilation model (for MSVCRT - multithreaded dll ? or LIBCMT.LIB : static lib c multithreaded, or LIBC.LIB : static lib C monothread etc) of your own project.
  • the compilation model of the SDL.dll

We don’t rely on a C runtime on Windows any more…this change just hit
CVS recently. Among other tapdancing it alleviates, it should also fix
the RWOps issues between DLLs.

At least, that’s my understanding.

–ryan.

It depends on :

  • the compilation model (for MSVCRT - multithreaded dll ? or LIBCMT.LIB : static lib c multithreaded, or LIBC.LIB : static lib C monothread etc) of your own project.
  • the compilation model of the SDL.dll

We don’t rely on a C runtime on Windows any more…this change just hit
CVS recently. Among other tapdancing it alleviates, it should also fix
the RWOps issues between DLLs.

At least, that’s my understanding.

Actually, I reverted it to Multithreaded DLL until 1.3, since it required
a binary compatiblity change (passing C runtime start/end routines to the
thread code). However, when it was enabled, SDL is not able to do rwops on
FILE * internally, since there was no stdio implementation to work with. :slight_smile:

-Sam Lantinga, Senior Software Engineer, Blizzard Entertainment

Hi all,

Thanks for the help.

Well I tried almost the same code with loading RWOps from file and memory it
worked fine, so I supposed it was because of my SDL-1.2 dll version against
the msvcrt one…

As I am fine with loading from file instead of file pointer, I think I wont
use the filepointer version anymore :-p

My code is working fine now, I just started to embed resources in it for
some “default behaviour” of my code :wink:

Thank you for that :wink:

2006/3/23, Sam Lantinga :>

It depends on :

  • the compilation model (for MSVCRT - multithreaded dll ? or
    LIBCMT.LIB : static lib c multithreaded, or LIBC.LIB : static lib C
    monothread etc) of your own project.
  • the compilation model of the SDL.dll

We don’t rely on a C runtime on Windows any more…this change just hit
CVS recently. Among other tapdancing it alleviates, it should also fix
the RWOps issues between DLLs.

At least, that’s my understanding.

Actually, I reverted it to Multithreaded DLL until 1.3, since it required
a binary compatiblity change (passing C runtime start/end routines to the
thread code). However, when it was enabled, SDL is not able to do rwops
on
FILE * internally, since there was no stdio implementation to work with.
:slight_smile:

    -Sam Lantinga, Senior Software Engineer, Blizzard Entertainment

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

It depends on :

  • the compilation model (for MSVCRT - multithreaded dll ? or LIBCMT.LIB : static lib c multithreaded, or LIBC.LIB : static lib C monothread etc) of your own project.
  • the compilation model of the SDL.dll

We don’t rely on a C runtime on Windows any more…this change just hit
CVS recently. Among other tapdancing it alleviates, it should also fix
the RWOps issues between DLLs.
Actually, I reverted it to Multithreaded DLL until 1.3, since it required
a binary compatiblity change (passing C runtime start/end routines to the
thread code). However, when it was enabled, SDL is not able to do rwops on
FILE * internally, since there was no stdio implementation to work with. :slight_smile:

True!
FILE * interface call cannot work even in 1.3 if SDL doesn’t use STDIO internally, I didn’t see that one :wink:

Btw , is there any provision for a generic SDL_RWFromCallbacks() call? where we could let the user choose entirely all the I/O functions and an opaque handle ? or the current SDL exports the SDLRWOps structure officially to do this?

This way an advanced user could do any kind of RW the way he wanted (or is it already the case?)

Regards,

Warning, I have not kept up with this thread, but thought I could be of
help. If I’m repeating something, or stating the obvious, or answering
the wrong question, I apologize.

You might want to check out this, which shows an example of exactly what
you seem to be talking about, which anyone can do as of now:

http://zziplib.sourceforge.net/zzip-sdl-rwops.html

…with further examplage at the end of this:

http://www.kekkai.org/roger/sdl/rwops/rwops.html

…hope that helps.On Thu, Mar 23, 2006 at 10:11:22PM +0100, William Petiot [exoide] wrote:

Btw , is there any provision for a generic SDL_RWFromCallbacks() call?
where we could let the user choose entirely all the I/O functions and
an opaque handle ? or the current SDL exports the SDLRWOps structure
officially to do this?

This way an advanced user could do any kind of RW the way he wanted
(or is it already the case?)


Steaphan Greene
GPG public key: http://www.cs.binghamton.edu/~sgreene/gpg.key.txt
-------------- next part --------------
A non-text attachment was scrubbed…
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: Digital signature
URL: http://lists.libsdl.org/pipermail/sdl-libsdl.org/attachments/20060323/5c81828f/attachment.pgp

Btw , is there any provision for a generic SDL_RWFromCallbacks() call? where we could let the user choose entirely all the I/O functions and an opaque handle ? or the current SDL exports the SDLRWOps structure officially to do this?

Yes, the File/Memory/etc functions are just for convenience, you can
roll your own RWops if you want…SDL_sound does this for some magic
internally, for example. Just allocate a structure and fill in the
function pointers with your own.

(See the zziplib example in the other reply, too!)

There’s a few extensions to the rwops interface that have been discussed
for 1.3 that will fill in some missing functionality gaps, but for most
cases, the existing interface is Good Enough.

–ryan.

[SDL_RWOps created by the user…]

This way an advanced user could do any kind of RW the way he wanted
(or is it already the case?)

You might want to check out this, which shows an example of exactly what
you seem to be talking about, which anyone can do as of now:

Yes, that’s exactly what I meant. Thanks !
You and Ryan peeked usefull examples about this precise use of RWOps.
So, obviously, there is no need to add anything :wink:

Regards,
William.