I am currently testing DerelictSDL2 (binding to the SDL2 library for D), and I have written code that successfully loads a JPG image and displays it in a window. That is, when it is compiled with dmd. When I try to use gdc (and not change the code), it compiles, but it does not load the image at runtime.
I believe that everything is correct:
SDL_Init(SDL_INIT_VIDEO)
then
IMG_Init(IMG_INIT_JPG)
and somewhere after that
this.data = IMG_LoadTexture(Window.renderer, name.ptr)
where Window.renderer(obviously) SDL_Renderer*and name.ptris char*pointing to the name of the uploaded image. But when compiled with gdc, IMG_Loadand IMG_LoadTextureboth return nulland with dmd return a pointer to the newly created texture ...
Have I forgotten anything else (in the end, he worked with dmd even without IMG_Init)? Does Derelict only work with dmd (even if it only interacts with C functions)?
dmd: 2.065
gdc: 4.9.1
EDIT:
It turns out that the problem is completely different. IMG_LoadTexturetakes a data pointer for its second argument, but name.ptrit seems to work only with dmd. However, if I try with a hard-coded argument as follows:
IMG_LoadTexture(renderer, "../test/res/image.jpg")
It works with both dmd and gdc.
source
share