Community
cancel
Showing results for 
Search instead for 
Did you mean: 
Daniel_D
Beginner
140 Views

Using TBB in a dll

Jump to solution

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
Black Belt
140 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

6 Replies
TimP
Black Belt
141 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

Daniel_D
Beginner
140 Views
Thanks for the insights.
140 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
SergeyKostrov
Valued Contributor II
140 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.
Daniel_D
Beginner
140 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.

SergeyKostrov
Valued Contributor II
140 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
Reply