Intel® C++ Compiler
Community support and assistance for creating C++ code that runs on platforms based on Intel® processors.

Using TBB in a dll

Daniel_D
Beginner
753 Views

Is it a problem if I compile an application without TBB that uses a dll that is linked with the TBB libraries? Or is it necessary that all parts of an application is set to use TBB if a single parts needs that?

0 Kudos
1 Solution
TimP
Honored Contributor III
753 Views
TBB may conflict with use of OpenMP or /Qparallel (and libraries such as mkl_thread which incorporate those). Other than that, I don't see a concern.

View solution in original post

0 Kudos
6 Replies
TimP
Honored Contributor III
754 Views
TBB may conflict with use of OpenMP or /Qparallel (and libraries such as mkl_thread which incorporate those). Other than that, I don't see a concern.
0 Kudos
Daniel_D
Beginner
753 Views
Thanks for the insights.
0 Kudos
Vladimir_P_1234567890
753 Views
there won't be 'conflict'. there might be oversubscription when there are heavy calculation at the same time in code using openmp and tbb.
--Vladimir
0 Kudos
SergeyKostrov
Valued Contributor II
753 Views
Answer on the1st Question:

I don'texpect any problems. If a DLL with TBB has some functions declared as exported any applications could call these functions.

The only difference between an application with integrated TBB functionalityvs. an application that uses a DLLwith TBB functionality is that in the 2nd caseTBB functionality will be loaded by OS loaderin a different address space.

You understand the main idea of aDLL, right? That is,a DLLcould beloaded by an application andthe DLL's functionality ( codes, data, etc )could be shared between different applications.

Answer on the 2nd Question:

In case of template-based libraries it is a common approach to includea template-based librarycompletely. Let's say a template-based library has classes A, B and C, and only class B is used in some application. In that case only codes for the class B will be compiled andused inthe application! Codes for classes A and C won't be included inthe application.It makes theapplication more compact.

I don'tknow if somebody uses an STL library througha DLL,but it is possible.
0 Kudos
Daniel_D
Beginner
753 Views

Hi Sergey,

Thanks for your answer. Yes I understand the main idea of a DLL that is the reason why I use them. I would not recommended using STL over DLL boundaries since you can never be sure that the same version of the STL library is used or that the DLL uses a custom allocator. That might end up with some resource leaks.

0 Kudos
SergeyKostrov
Valued Contributor II
753 Views
>>...I would not recommended using STL over DLL boundaries since you can never be sure that the same version of the STL library is used...

Hi Daniel, I agree with you regarding anSTL in a DLL. That breaks amain idea oftemplate based programming.

>>...That might end up with some resource leaks...

Yes, especially when a developer creates an object with 'new' C++ operator and never calls 'delete' C++ operator... :)

Best regards,
Sergey
0 Kudos
Reply