# Magical values in Tsdl

**URL:** <https://discuss.ocaml.org/t/magical-values-in-tsdl/3817>\
**Category:** Learning\
**Tags:** ctypes\
**Created:** [May 17, 2019, 4:56am UTC](https://discuss.ocaml.org/t/magical-values-in-tsdl/3817 "2019-05-17T04:56:58Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![fccm](https://sea2.discourse-cdn.com/flex020/user_avatar/discuss.ocaml.org/fccm/32/1587_2.png) [@fccm](https://discuss.ocaml.org/u/fccm)\
**Post date:** [May 17, 2019, 4:56am UTC](https://discuss.ocaml.org/t/magical-values-in-tsdl/3817/1 "2019-05-17T04:56:58Z")

</div>

Hi,  
As an exercise I’m trying to add the new SDL\_DisplayEvent struct that  
appeared in the last SDL2 2.0.9 to tsdl:

diff -u SDL2-2.0.6/include/SDL\_events.h SDL2-2.0.9/include/SDL\_events.h

> <https://gist.github.com/fccm/a7a2739137b99ad75e271f04cae95a60>

Here you can see my attempt as the git diff to the last tsdl git:

> <https://gist.github.com/fccm/99469a7ab436ef6a47927e5d1e6dda59>

I tryed to follow the other events as example, and to add the new  
display event, but I’m having difficulty to figure out how to write at  
line 50:  
let display\_event = 0x150 (\* compiles fine _)  
that should probably be:  
let display\_event = sdl\_displayevent  
if I follow the other events there, like for example:  
let window\_event = sdl\_windowevent (_ at line 4227 _)  
let clipboard\_update = sdl\_clipboardupdate (_ at line 4011 \*)  
from:

> <https://github.com/dbuenzli/tsdl/blob/master/src/tsdl.ml>

What I don’t catch is where “sdl\_windowevent” comes from?  
Because if I write the equivalent:  
let display\_event = sdl\_displayevent  
I get:  
Error: Unbound value sdl\_displayevent

---

<div class="post-metadata">

**Author:** ![octachron](https://avatars.discourse-cdn.com/v4/letter/o/49beb7/32.png) [@octachron](https://discuss.ocaml.org/u/octachron)\
**Post date:** [May 17, 2019, 10:06am UTC](https://discuss.ocaml.org/t/magical-values-in-tsdl/3817/2 "2019-05-17T10:06:52Z")

</div>

Constants are listed in `support/consts_stubs.c`, you should probably add a line equivalent to:

```auto
int_v(SDL_DISPLAYEVENT);

```
