|
D Derelict test program macOS |
Joel Christensen
Member #5,103
October 2004
|
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? 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
Member #1,881
January 2002
|
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. -----sig: |
torhu
Member #2,727
September 2002
|
Hm, what error message are you getting? |
Joel Christensen
Member #5,103
October 2004
|
Program exited with code -11
|
torhu
Member #2,727
September 2002
|
Right, tried running it in the debugger? |
Joel Christensen
Member #5,103
October 2004
|
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
Member #628
September 2000
|
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
Member #1,881
January 2002
|
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. -----sig: |
|