Use bindbc-sdl statically
Ishax
isaacbunsen at gmail.com
Sat Apr 24 17:38:24 UTC 2021
On Saturday, 24 April 2021 at 17:20:06 UTC, russhy wrote:
> This should work
I just tried your code. I get:
```Program exited with code -1073741701```
I put the libraries straight into the project root this time.
```sdl
name "sdl2try2"
description "A minimal D application."
authors "Isaac"
copyright "Copyright © 2021, Isaac"
license "proprietary"
dependency "bindbc-sdl" version="~>0.1.0"
versions "BindSDL_Static"
subConfigurations "bindbc-sdl" "staticBC"
sourceFiles "sdl2.lib" "sdl2_image.lib"
```
```d
import bindbc.sdl;
import core.stdc.stdio;
const SCREEN_WIDTH = 1024;
const SCREEN_HEIGHT = 720;
int main() {
SDL_Window* window = null;
SDL_Surface* screenSurface = null;
if (SDL_Init(SDL_INIT_VIDEO) < 0) {
printf("could not initialize sdl2: %s\n", SDL_GetError());
return 1;
}
window = SDL_CreateWindow(
"hello_sdl2",
SDL_WINDOWPOS_UNDEFINED, SDL_WINDOWPOS_UNDEFINED,
SCREEN_WIDTH, SCREEN_HEIGHT,
SDL_WINDOW_SHOWN
);
if (window == null) {
printf("could not create window: %s\n", SDL_GetError());
return 1;
}
screenSurface = SDL_GetWindowSurface(window);
SDL_FillRect(screenSurface, null,
SDL_MapRGB(screenSurface.format, 0xFF, 0xFF, 0xFF));
SDL_UpdateWindowSurface(window);
SDL_Delay(2000);
SDL_DestroyWindow(window);
SDL_Quit();
return 0;
}
```
More information about the Digitalmars-d-learn
mailing list