In the FFI you can take an enum such as the following from the SDL library:
typedef enum {
SDL_GL_RED_SIZE,
SDL_GL_GREEN_SIZE,
SDL_GL_BLUE_SIZE,
SDL_GL_ALPHA_SIZE,
SDL_GL_BUFFER_SIZE,
SDL_GL_DOUBLEBUFFER,
SDL_GL_DEPTH_SIZE,
SDL_GL_STENCIL_SIZE,
SDL_GL_ACCUM_RED_SIZE,
SDL_GL_ACCUM_GREEN_SIZE,
SDL_GL_ACCUM_BLUE_SIZE,
SDL_GL_ACCUM_ALPHA_SIZE,
SDL_GL_STEREO,
SDL_GL_MULTISAMPLEBUFFERS,
SDL_GL_MULTISAMPLESAMPLES
} SDL_GLattr;
What is the best way to define this as a foreign type?
If you do the following:
(c-define-type SDL_GLattr "SDL_GLattr")
Then to get at the values you have to assign a pointer to the enum value
(c-lambda ()
SDL_GLattr
"___result_voidstar = &SDL_GL_SWAP_CONTROL;")
Seems like passing the actual value would be preferable. Am I missing
something obvious?