Intel® Fortran Compiler
Build applications that can scale for the future with optimized code designed for Intel® Xeon® and compatible processors.
Announcements
Important Update: Community Platform Migration​. Learn more​>
29657 Discussions

Linking a DLL using Single-threaded DLL V mutltithreaded DLL

anthonyrichards
New Contributor III
1,539 Views
If I create andinstall aDLL which contains routines that are called by a third party application which is multithreaded, must my DLL be linked with the single- or multithreaded dll libraries?
0 Kudos
4 Replies
g_f_thomas
Beginner
1,539 Views

I'd say the latter which comesat negligible cost over single. Even if your DLL is single your project is now multithreaded by courtesy of the 3rd party threaded library.

Gerry

0 Kudos
Steven_L_Intel1
Employee
1,539 Views
If the Fortran library can be called from multiple threads, it is critical that you choose the multithread library. It is not that the library itself makes your application threaded, but by choosing the multithread library it is thread safe.
0 Kudos
g_f_thomas
Beginner
1,539 Views

MADsblionel:
It is not that the library itself makes your application threaded, but by choosing the multithread library it is thread safe.

Neither of these assertions is correct. If all one had to do was link to multithreaded libraries to attain thread safety then there would be no need to use vTune, Thread Checker, Thread Profiler, Threading Blocks, etc. If you link a single threaded clientto a multithreaded library you havea multithreaded app that isn't necessarily thread safe.

Gerry

0 Kudos
Steven_L_Intel1
Employee
1,539 Views
Sorry, that wasn't quite what I meant. I meant that the Fortran runtime library was thread safe so that you could do I/O from a multithreaded application. If you don't use a multithreaded library from a threaded application you could have I/O errors.
0 Kudos
Reply