I am trying to call some SDL2 functions from the SDL2.dll in Julia, but I keep getting unable to load error. I’m not sure what I’m doing wrong. I followed the help files in the calling C and Fortran help files.
What example did you follow? ccall doesn’t have a signature like this, and I can’t even recognize what you are trying to do. What do you think each argument to ccall means in your code?
I followed the example on the CCall example from the help pages. I changed it, but I still get the same error. SDL_Init is an unsigned int var that has another unsigned int for its flags.
Well, there are still at least 3 syntactic error here that don’t depend on ccall:
parentheses are not balanced
(UInt32) is not a tuple, (UInt32,) is
variable flags is never defined
There may also be 2 logical errors:
for ccall((:func, "lib"), ...) to work “lib” should be on your loading path; if it’s not, you should use ccall((:func, "/full/path/to/lib"), ...) instead, otherwise ccall just won’t know where to look for your function
according to SDL2 docs, SDL_Init returns int in C and thus Cint in Julia, which is an alias to Int32, not UInt32.
I have a semi-functional wrap of SDL2 that I made using Clang.jl (that automatically write all the function signatures from the C headers), I can make a repository if you are interested, it’s easier than trying to wrap things by hand.
Did you have a look at GLFW?! At least when i was deciding for a windowing library, i decided for GLFW for it’s active development and nicely wrapped Julia library. Its Julia wrapper lives in GLFW.jl!
Ignore this, when you actually rather need the wrappers for sound etc, which isn’t part of GLFW.