The /M flag must be changed for *all* linked modules. It must be the same in 
each and every module that you link. If you change the flag, you must make sure 
that FLTK and all other modules are build from scratch, or you will get exactly 
the heap corruption that you described. 

We chose the /M flag very carefully. It i set to multithreading with dll 
support. IMHO the only correct setting if you want to do any kind of run-time 
linking, or link with any dll at all.

On 30.06.2012, at 00:37, Mikhail Tchernychev wrote:

> Here what I just did to reproduce:
> 
> Downloaded latest r9631;
> 
> Changed "code generation" to /MTd
> for hello, fltkdll, fltkjpeg, fltkzlib, fltkpng
> 
> Explicitly changed it to /MTd for file jmemobs.c from JPEG
> 
> Changed project reference for hello to fltkdll
> 
> Removed fltkd.lib from link
> 
> changed subsystem for hello to "console" (if not, it expects
> WinMain)
> 
> Compiled.
> 
> Now it runs. Added destructor. Now it crashes.
> 
> 
> I used static linking at home and /MDd at home and I recall
> it worked.
> 
> 
> I hope it helps.
> 
> Best Regards,
> Mikhail
> 
> 
>> Hmm, Mikhail, it works absolutely correctly without any errors on my system 
>> (Windows Seven 64, VC2010 Express, Debug, latest svn rev 9631).
>> I'm afraid it's problem with your machine only. Which version of FLTK do you 
>> use? Do you use something else? Be sure you don't mix headers and .lib files 
>> from different versions of the library.
>> 
>> 
>>> This is happens in Debug build. It's actually
>>> "Debug Assertion Failed" showing that heap is
>>> corrupted. Stack is not useful. Going step by step
>>> I found that it happens after ~Fl_Window();
>>> xclass in Fl_Window is set to NULL.
>>> The program is here:
>>> 
>>> #include <FL/Fl.H>
>>> #include <FL/Fl_Window.H>
>>> #include <FL/Fl_Box.H>
>>> 
>>> //#include <vld.h>
>>> 
>>> int main(int argc, char **argv) {
>>> //  Fl_Window window(340,180);;
>>> 
>>>  Fl_Window *window = new Fl_Window(340,180);
>>>  Fl_Box *box = new Fl_Box(20,40,300,100,"Hello, World!");
>>>  box->box(FL_UP_BOX);
>>>  box->labelfont(FL_BOLD+FL_ITALIC);
>>>  box->labelsize(36);
>>>  box->labeltype(FL_SHADOW_LABEL);
>>>  window->end();
>>>  window->show(argc, argv);
>>>  int ret = Fl::run();
>>>  delete window;
>>> 
>>>  return 0;
>>> }
>> 
>> Nikita Egorov
>> 
>> 
> 
> _______________________________________________
> fltk-dev mailing list
> fltk-dev@easysw.com
> http://lists.easysw.com/mailman/listinfo/fltk-dev

_______________________________________________
fltk-dev mailing list
fltk-dev@easysw.com
http://lists.easysw.com/mailman/listinfo/fltk-dev

Reply via email to