MSVC++ 6.0 detecting if compiling multi or single threaded
I discovered by accident a flag that tells whether DX is created as single or multi threaded.
I have been compiling everything a multithreaded but not telling DX itself to be multi-threaded.
Eventually I wan to ship both single and multithreaded versions of the game engine so need to be able to tell if the compiler options is
/MT for multithreaded or
/ML for single threaded.
The line below would then use this to have the correct setting.
DWORD dwMulti = D3DCREATE_MULTITHREADED;
Any ideas?
Also...I decided to make the libraries and DLL multithreaded...the reasoning being people can use multithreading in their apps if they want.
Are there any drawbacks if having a multithreaded app but not using any threading?
There is a small performance hit - because some tread-safe functions are made thread-safe using mutexes (thus they lock/unlock a mutex, and while this is not really an expensive operation, it is not free). If you are using only one thread then I suggest you to compile using the single-thread libraries.
VS.NET 7.1 defines the preprocessor macro _MT if one of the compiler flags /MT, /MTd, /MD or /MDd is defined.
HTH,
VS.NET 7.1 defines the preprocessor macro _MT if one of the compiler flags /MT, /MTd, /MD or /MDd is defined.
HTH,
OK...thanks. I will see if MSCV++ 6.0 supplies a similar macro.
I also noticed that most libraries offer a *_m.lib and *_s.lib for multi threaded or singled threaded linking.
One example is the tokamak physics SDK that also supplies a debug and release version of each.
I most prob will ship my SDK with just the release single threaded version and offer the others as a separate download if wanted.
I also noticed that most libraries offer a *_m.lib and *_s.lib for multi threaded or singled threaded linking.
One example is the tokamak physics SDK that also supplies a debug and release version of each.
I most prob will ship my SDK with just the release single threaded version and offer the others as a separate download if wanted.
Just as an aside, Microsoft have got rid of the single-threaded CRT libraries in VS 2005, so you may end up long-term having the decision made for you. Given how AMD and Intel both seem to be pushing concurrency in a big way for their long-term plans as well, multi-threading seems more and more to be the way people are going.
Edit: Add quote from CodeGuru:
Edit: Add quote from CodeGuru:
Quote:Single-Threaded CRT Support
Single-threaded CRT support has been removed. You had an option to link to the multi-threaded or single-threaded CRT. Going forward, it is believed that most people will want to work with the thread-safe multi-threaded routines.
_nolock suffix routines can be used to optimize your code. In exchange for being optimized, these functions are not thread safe.
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement