I am following the example from the Red documentation here: http://static.red-lang.org/red-system-specs.html#section-14
This is my code:
Red []
#import [
"SDL2.dll" cdecl [
sdl_init: "SDL_Init" [
flags [integer!]
return: [integer!]
]
]
]
rc: sdl_init 0
When I execute this with the Red interpreter, I get the following error on the last line:
*** Error: word has no value!
*** Error: word has no value!
Compiling with red -c
gives a more useful error:
*** Compilation Error: undefined word sdl_init
*** in file: %/C/temp/red/sdl.red
*** near: [sdl_init 0]
Obviously the sdl_init
definied during the import of the library is out of scope by the time it gets to the last line.
How do you explain the example in the documentation then? If I initialize sdl_init
to some arbitrary value prior to the import, it still retains the same value after the #import
block.