Allegro.cc - Online Community

Allegro.cc Forums » Programming Questions » [A5] al_create_native_file_dialog() crashes

This thread is locked; no one can reply to it. rss feed Print
[A5] al_create_native_file_dialog() crashes
ehguacho
Member #13,054
July 2011

hi! me again. i'm having some issues with the al_create_native_file_dialog() function. what i'm trying to do is to show a dialog to open file, like file_select_ex() for the old A4. for some reason wich i don't know, mi app crashes while calling the al_create_native_file_dialog() function.

ALLEGRO_FILECHOOSER *OpenFile = al_create_native_file_dialog("C:\\", "Open File", NULL, ALLEGRO_FILECHOOSER_FILE_MUST_EXIST);

i know that's an OS native function, so i must say that i'm using Win7. what am i doing wrong?

thank you all in advance!

Matthew Leverton
Supreme Loser
January 1999
avatar

Try "*.*" as the third parameter.

ehguacho
Member #13,054
July 2011

tried that already, and didn't work. also i tried it by modifying the fourth parameter, but no luck neither.

Matthew Leverton
Supreme Loser
January 1999
avatar

It shouldn't crash. You'll probably have to walk through the Allegro code with a debugger.

ehguacho
Member #13,054
July 2011

and how should i do that? i'm using code::blocks 10.05.

Edgar Reynaldo
Major Reynaldo
May 2007
avatar

Code::Blocks is your IDE, not your compiler. I'm guessing you're using MinGW, so you need to download gdb from the sourceforge site for MinGW. The latest version of gdb also requires some runtime library which I can't remember at the moment. You can also find it at sourceforge in the MinGW project.

Once you have gdb installed to your path (or your path adjusted to include the directory where gdb is) ((putting it in mingw/bin is probably the best option)), then you run your program through gdb. (You'll need to compile your program with debugging symbols, and link to the debugging version of Allegro).

gdb my_program.exe
>...
>run
CRASH!
>backtrace
0 function 0x0000blah from sourcefile.c line 123
1 ...
2 ...
...

What we need is to see the results of the backtrace.

Matthew Leverton
Supreme Loser
January 1999
avatar

The only reason why it "should" crash is if you haven't initialized Allegro. So if you are doing that, then proceed to debug.

Go to: