D Derelict test program macOS
Joel Christensen

I'm trying to do a minimal program with graphics in the D programming language (dlang.org) using Derelicts Allegro binding on macOS. I used brew install allegro.

Has any one else gotten Allegro 5 going with D on macOS?

#SelectExpand
1import derelict.allegro5; 2 3import std.stdio: writeln; 4 5ALLEGRO_DISPLAY* DISPLAY; 6 7int main() { 8 DerelictAllegro5.load(); 9 10 return DerelictAllegro5.run( { 11 if (! al_init()) { 12 writeln("failed to initialize allegro!"); 13 return -1; 14 } 15 16 DISPLAY = al_create_display( 640, 480 ); 17 assert(DISPLAY, "failed to create display"); 18 scope(exit) al_destroy_display( DISPLAY ); 19 20 al_clear_to_color(al_map_rgb(255,180,0)); //#error return value -11 21 al_flip_display(); 22 23 al_rest(2); 24 25 return 0; 26 } ); 27}

Chris Katko

I run it with DAllegro in Linux. It works fine.

At a quick glance, DerelictAllegro looks like it's not maintained anywhere near that of DAllegro and may be behind in Allegro 5 versions. I'm not a big fan of the naming convention either. But if it works for you, that's cool.

https://github.com/SiegeLord/DAllegro5

torhu

Hm, what error message are you getting?

Joel Christensen

Program exited with code -11

torhu

Right, tried running it in the debugger?

Joel Christensen

No, I haven't discovered debuggers. [snip]

I don't know how, or if I can use a debugger in D on macOS.

Mike Parker

Looks like it's a thread-related issue. It works when DISPLAY is marked __gshared, or the declaration is moved inside the function literal. That means it's an issue with the binding and not Allegro.

Chris Katko

Sorry, I totally missed your error message on your code on my screen width. I thought you were just asking about people's experiences with D and Allegro.

Thread #616943. Printed from Allegro.cc