Re: [Quickfix-developers] QuickFix on VS2015
Brought to you by:
orenmnero
From: <daw...@ya...> - 2017-07-02 06:48:26
|
Hi Frank, This is gold dust.. thanks so much! I had a horrible feeling I'd need to roll back the VS version but your fix worked a charm and saved me a lot of time and stress. Thanks Again! Dermot ----- Original Message ----- >From: K. Frank <kfr...@gm...> >To: "qui...@li..." <qui...@li...> >Date: 2017/7/2, Sun 01:10 >Subject: Re: [Quickfix-developers] QuickFix on VS2015 > >QuickFIX Documentation: http://www.quickfixengine.org/quickfix/doc/html/ > >Hello Dermot! > >I think you may be running into a known (sem-) bug. See comments, >in line, below. > >On Sat, Jul 1, 2017 at 3:33 AM, <dra...@ac...> wrote: >> >> Hi All, Can someone please tell me the position on QuickFix on VS2015. Is it supported? > >I cannot speak as to whether QuickFIX is supported on VS2015. > >> I upgraded the VS2012 solution file to VS2015 and got it to compile by changing one line of code in Utility.cpp, line 399:- > >I think that there is an outright bug in the windows version of QuickFIX, >that, for whatever reason, was tolerated by some versions of VS, perhaps >VS2012. Since I believe that it's a bug, then I wouldn't be surprised to >find out that it is no longer tolerated by newer versions of VS, for example, >VS2015. > >> OLD: result = _beginthreadex( NULL, 0, &func, var, 0, &id ); >> NEW: result = _beginthreadex( NULL, 0, (unsigned(__stdcall*)(void*)) &func, var, 0, &id ); > >Speaking from memory, "func" in an actual pointer-to-function (not the name >of a function which would then "decay" to pointer-to-function). So &func is a >pointer-to-pointer-to-function and is therefore the wrong type for the third >argument of _beginthreadex. (The third argument should be pointer-to-function.) > >If I am right that your cast is a microsoftian version of >pointer-to-function, then >your cast is completely bogus: You pass in the address of a location in memory >that holds the address of a function, but you lie to the compiler, and >tell it that >you are passing in the address of a function. > >> Then compiled and ran the tradeclient example. Creating the initiator object took about 30 seconds (it was pretty instantaneous on VS2010) and then it became unstable after the call to initiator.start() - it crashed on the subsequent call to std::cout in application.run(). > >I'm not at all surprised that you get a crash. I imagine that your >spawned thread >tries to run "random data" on the stack or heap somewhere as if it >were a function, >so you get "undefined behavior" / crash /.corruption. > >> Any ideas? > >I believe that the correct fix would be to remove the "&" from "&func", that is, >instead of using your cast, replace > > result = _beginthreadex( NULL, 0, &func, var, 0, &id ); > >with > > result = _beginthreadex( NULL, 0, func, var, 0, &id ); > >This worked for me some years ago with an older version of QuickFIX using >mingw_w64 instead of VS. > >There are two old threads about this issue: > > https://sourceforge.net/p/quickfix/mailman/quickfix-developers/thread/CANL%3DBToQ%2BwdfkL-XwBO-pX8Wb%3DBFpmxxPD80kWNH50d7tF0SOg%40mail.gmail.com/#msg30386701 > > https://sourceforge.net/p/quickfix/mailman/message/35810081/ > >The short story is that I think "&func" is a bug, my fix worked for me >using mingw_w64, >my fix seems to have worked for someone using "visual studio community >2015", the >bug version ("&func") worked for Mike Gatny on a 32-bit VS version >back in 2013, the >bug is not present in the linux version of QuickFIX, and I've never >understood why the >"&func" version ever compiled on windows (although I don't doubt that it did). > >Unless I'm completely confused about what seems to be straightforward >c++, this really >is a bug in the windows version of QuickFIX and it ought to be fixed >in the QuickFIX source. > >> Thanks, >> Dermot > > >Happy Hacking! > > >K. Frank > >------------------------------------------------------------------------------ >Check out the vibrant tech community on one of the world's most >engaging tech sites, Slashdot.org! http://sdm.link/slashdot >_______________________________________________ >Quickfix-developers mailing list >Qui...@li... >https://lists.sourceforge.net/lists/listinfo/quickfix-developers > > > |