I'm writing a library where I'm linking to the open source version of tbb built as a static lib. This works fine but when I static link my library into a program it asks for the tbb library and I want my library to be self contained so people can use it without needing to link against tbb themselves. I've had a similar thing with boost where you can use a preprocessor definition to make your library self contained. I'm wondering how I can achieve this with tbb?
Thanks a lot!
You shouldn't try to do that, unless you want to do your users a great disservice. Oversubscription hurts performance, so TBB is presented as a dynamically linked library partly to get all parts of a program to coordinate through shared constructs and thus help achieve composability.
I'm aware of the issue of multiple tbb schedulers being active and my thought was to let the user disable the scheduler in the library and supply their own if they are using tbb themselves (although I admit I haven't looked into that possibility yet). Would that not work?
I don't see how having tbb as a dynamic library would stop an oversubscription situation if the user is managing threads themselves or using something like openmp in their program?