Derelict と D を使用して、単純なグラフィックス テスト プログラムを作成しようとしています。
SDL でほぼすべてのことをしようとすると、セグメンテーション フォールトが発生します。問題が発生しているコードは次のとおりです。
import std.stdio;
import derelict.opengl3.gl3;
import derelict.sdl2.sdl;
import derelict.sdl2.image;
import derelict.sdl2.mixer;
import derelict.sdl2.ttf;
import derelict.sdl2.net;
void main()
{
SDL_Window* mainWindow;
SDL_GLContext mainGLContext;
try
{
DerelictGL3.load();
// Load the SDL 2 library.
DerelictSDL2.load();
.
DerelictSDL2Image.load();
DerelictSDL2Mixer.load();
DerelictSDL2ttf.load();
DerelictSDL2Net.load();
}
catch(Exception e){}
finally{}
// Initialise SDL
if( SDL_Init( SDL_INIT_EVERYTHING ) == -1 ) {
throw new Exception("SDL initialization failed");
}
SDL_GL_SetAttribute(SDL_GL_CONTEXT_MAJOR_VERSION,3);
SDL_GL_SetAttribute(SDL_GL_CONTEXT_MINOR_VERSION,3);
Uint32 flags = SDL_WINDOW_SHOWN|SDL_WINDOW_OPENGL;
int width = 1024;
int height = 768;
mainWindow = SDL_CreateWindow("SDL2 OpenGL Example", SDL_WINDOWPOS_UNDEFINED, SDL_WINDOWPOS_UNDEFINED, width, height, flags);
mainGLContext = SDL_GL_CreateContext(mainWindow);
DerelictGL3.reload();
SDL_DestroyWindow(mainWindow);
SDL_Quit();
}
SDL_GL_SetAttribute()
以下のすべてがコメントアウトされていても、問題は引き続き発生します。
さらに、SDL をロードしようとすると derelict が例外をスローしますが、これはかなり一般的だと思います。
derelict.util.exception.SymbolLoadException@../../.dub/packages/derelict-util-2.0.4/source/derelict/util/exception.d(35): 共有ライブラリ libSDL2 からシンボル SDL_QueueAudio を読み込めませんでした。それで
私は Elementary OS を実行しており、apt-get を使用して SDL が最新であることを確認しています。
ご助力ありがとうございます。