On 16.07.2011 23:57, Carlos Luna wrote: >> >> ALSO: perhaps it's no longer needed, but I thought FLTK apps >> that used the FLTK image library had to call: >> >> fl_register_images(); >> >> ..at the top of main() to ensure the lib properly initialized. >> So you should try adding that as the first thing in your main(). > > Ok, added the > > fl_register_images(); > > line and everything works OK so far. What exactly does it achieve?
fl_register_images() "registers" some image formats to automatically recognize image types (GIF, BMP, and JPEG) for Fl_Shared_Image usage. See src/fl_images_core.cxx. I could be wrong, but IMHO this has *nothing* to do with your program that uses Fl_PNG_Image directly, AFAICT from the code you posted. > I mean, if it was totally needed then the app shouldnÂŽt work at all when > that line isnÂŽt included, right? It wouldn't recognize image formats if you used Fl_Shared_Image::get() or something like that; hence this would fail, but not your code loading a Fl_PNG_Image file. > Confusing. Sorry for the late reply, but your problem looks much like a Heisenbug, i.e. adding a printf() call or other unrelated code changes might have "fixed" the problem as well. There is probably a side effect in other code that overwrites something in memory. To check whether this could be true, please _replace_ the statement fl_register_images() with some other totally unrelated code like a printf() statement, and see if this fixes the problem too. Note that it should be something that can not be optimized out by the compiler like an assignment to an otherwise unused variable. You wrote that making the folder name one byte longer changes the program's behavior. This might change the memory layout of a variable by 1 to 8 bytes, and thus the program may fail or not. The same could be when compiled in "Debug" mode. I suggest to check the other code involved for variables (pointers) going out of scope etc.. There must be another reason. Albrecht _______________________________________________ fltk mailing list [email protected] http://lists.easysw.com/mailman/listinfo/fltk

