Open joelcnz opened 7 years ago
Joel, if you have bugs with DerelictAllegro5, this is definitely the place to post them. But this is not an Allegro support forum. I don't use Allegro that much myself and for me to help you would require me to dig into the Allegro docs and debug your programs for you. I don't have time for that. Please take issues like this to the Allegro forums at allegro.cc if you can't solve them yourself. If you later determine a problem is with the binding, then by all means report it here.
Alright, I need you to clarify something. When you said "error return value", it sounded like you were talking about the return value of a function. But are you actually talking about a message you're getting from the system?
Yes, it displays "Program exited with code -11" in the terminal, when I run the program.
Also, I posted it on allegro.cc and some one said that the code worked on DAllegro, using Linux.
I've tested your code on my MacBook and it crashes for me, too. Running in the debugger shows a segmentation fault. Looks like it's a thread-related issue. Marking DISPLAY
as __gshared
or moving the declaration inside the function literal makes the crash go away.
I recommend using __gshared on any of your globals for now, just as a temporary workaround until I can figure out how to solve this.
It doesn't crash with __gshared, but it doesn't give me the colour either.
Also, if I use a bitmap with it it crashes again:
ALLEGRO_BITMAP* bmp = al_create_bitmap(640,480);
assert(bmp, "create bitmap failed!");
scope(exit) al_destroy_bitmap( bmp );
al_set_target_bitmap(bmp);
al_clear_to_color(al_map_rgb(255,180,0));
How did you run the program in a debugger? Some one said about using a debugger before your post.
When you install XCode, you get the clang tools, which includes the lldb debugger. Run lldb <program_name>
to debug. You'll want to compile your D programs with -gc
(though -g
might work as well with lldb, these days, don't know), so add that to a dflags
field in your dub configuration.
I've had nothing but trouble trying to bind dynamically with Allegro. These Mac issues are just more in a long line of them. I may end up abandoning this completely and just directing people to DAllegro. Never had issues with like this with any other C library I've created a Derelict binding for.
Thanks for your replies. I'll look at DAllegro next, (I have an old version on a Windows computer to update. It didn't have dub back then).