Key event inconsistency

Hi all,

For my project I have an application where everything is linked staticly and
another where my
SDL related code is located inside a DLL. The key event appears to be
incosistent with these
two scenario’s. For the staticly linked scenario I must use key.keysym.mod
while this is 0 for
the dynamicly linked version in which case I must use key.keysym.sym to get
a propper value.
In both cases the same SDL DLL is used.
if mod is non-zero then using sym gives me garbage. I use the following
macro to fix it:

#define SDLKEYCODE( event ) ( (event).key.keysym.mod ?
(event).key.keysym.mod : (event).key.keysym.sym )

Although the problem is fixed I can’t help wonder what the hell is going on
here.
I really doubt this is desired behaviour.

System info:
O/S: Win32: XP (US version)
SDL version: 1.2.6 (binary distribution in dll form)
CPU: Mobile P4 1.6 Ghz
RAM: DDR 512 MB

GreeTz,
Dinand Vanvelzen.

For my project I have an application where everything is linked staticly and
another where my
SDL related code is located inside a DLL. The key event appears to be
incosistent with these
two scenario’s. For the staticly linked scenario I must use key.keysym.mod
while this is 0 for
the dynamicly linked version in which case I must use key.keysym.sym to get
a propper value.

So the dynamicly linked version is correct, if i understood well.
See http://sdldoc.csn.ul.ie/sdlkeysym.php

In both cases the same SDL DLL is used.

So do you mean you have an exe which is linked to a dll which in turn is
dynamicly linked to sdl?

if mod is non-zero then using sym gives me garbage.

Sounds like an alignment problem, though i don’t know why it would happen
in your code.
You should at least tell us what compiler you use, and where the code is.
(dll or exe?)

macro to fix it:

#define SDLKEYCODE( event ) ( (event).key.keysym.mod ?
(event).key.keysym.mod : (event).key.keysym.sym )

What if there’s a modifier?–
Hibernatus

So do you mean you have an exe which is linked to a dll which in turn is
dynamicly linked to sdl?

Yes, in the dynamicly linked scenario.

#define SDLKEYCODE( event ) ( (event).key.keysym.mod ?
(event).key.keysym.mod : (event).key.keysym.sym )

What if there’s a modifier?

Then it no longer works :slight_smile:
It’s just meant to be a temp fix untill this is sorted out.

GreeTz,
Dinand Vanvelzen.

----- Original Message -----
From: combel_t@epita.fr (Hibernatus)
To:
Sent: Friday, May 07, 2004 6:18 AM
Subject: Re: [SDL] Key event inconsistency

You didn’t tell us which compiler. Anyway, if you use msvc 7 try
recompiling sdl, and use the new sdl.lib.–
Hibernatus

You didn’t tell us which compiler. Anyway, if you use msvc 7 try
recompiling sdl, and use the new sdl.lib.


Hibernatus

I use Borland C++ Builder 6.
I don’t use the VCL or CLX library’s.

recompiling SDL is a nightmare. I had to change a wide range of things to
compile
the SDL code into my networking library which is why my GUCEF library (which
has the key problem)
still uses the SDL.dll that’s available from the SDL website.
The modified & minimalised source is available from my download page of the
GUCEF project btw.
http://users.skynet.be/GalaxyUnlimited/GUCEF/ (domain name is down atm).

I always had problems using SDL. I posted here ages ago about access
violation problems I had to no avail.
I use OpenGL exclusivly for my library’s with the exception of the
networking library which uses the dummy driver.
Compiling the SDL source into the networking libray fixed all the SDL
problems. I posted back then that enabling
codegaurds (IDE feature) “validate stack and stack accesss” option prevented
the problem. This is still needed
today for the library’s that dynamicly link to SDL (SDL.dll).

GreeTz,
Dinand Vanvelzen.

----- Original Message -----
From: combel_t@epita.fr (Hibernatus)
To:
Sent: Friday, May 07, 2004 11:48 AM
Subject: Re: [SDL] Key event inconsistency