Brian Dessent writes: > Jonathan Kinsey wrote: > > > Thanks for the link, unfortunately it doesn't work _beginthread just > > calls _beginthreadex - unless there is a alignment argument I didn't see > > (I tried it anyway and no luck). > > > > If you read the end of the post at the link it says that it doesn't fix > > a SSE problem that someone was having - at least I'm not on my own... > > I did read that but I hoped it was someone having unrelated problems. I > guess it's not. > > So, neither CreateThread nor MSVCRT align the stack, so I guess you'll > have to do it yourself. You should be able to do this with something > like: > > asm __volatile__ ("andl $-16, %%esp" : : : "%esp"); > > at the beginning of your thread function. Ouch. I don't think that would work. > You could probably do this in a wrapper-function that calls your > actual thread function too. That sounds like a much better idea, although it may well also be problematic. A pure assembly function that did the adjustment and called your actual thread function would be the best idea. Andrew.