# CUDA and Static Libraries

**URL:** <https://forums.developer.nvidia.com/t/cuda-and-static-libraries/11452>\
**Category:** CUDA Programming and Performance\
**Created:** [August 7, 2009, 10:36pm UTC](https://forums.developer.nvidia.com/t/cuda-and-static-libraries/11452 "2009-08-07T22:36:18Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![John\_Soucie](https://developer.download.nvidia.com/images/forums/profile-default-devtalk-84.png) [@John\_Soucie](https://forums.developer.nvidia.com/u/John_Soucie)\
**Post date:** [August 7, 2009, 10:36pm UTC](https://forums.developer.nvidia.com/t/cuda-and-static-libraries/11452/1 "2009-08-07T22:36:18Z")

</div>

I am developing an application that must be distributed as a single monolithic executable. I have been experimenting with CUDA version 2.1. I am at a point of either integrating NVIDIA CUDA support into my application or abandoning the effort. Are there static CUDA libraries available that can be linked into my application rather than DLL’s to enable me to move forward with this integration? The DLL that is in question right now is the cudart.dll. It would be great to get an equivalent cudart.lib with static code rather than just the dynamic code. Is there any such distribution?

---

<div class="post-metadata">

**Author:** ![tmurray](https://developer.download.nvidia.com/images/forums/profile-default-devtalk-84.png) [@tmurray](https://forums.developer.nvidia.com/u/tmurray)\
**Post date:** [August 7, 2009, 10:49pm UTC](https://forums.developer.nvidia.com/t/cuda-and-static-libraries/11452/2 "2009-08-07T22:49:14Z")

</div>

You’re going to have to use the driver API. There is no static cudart for various reasons, and I don’t expect that to change anytime soon.

---

<div class="post-metadata">

**Author:** ![John\_Soucie](https://developer.download.nvidia.com/images/forums/profile-default-devtalk-84.png) [@John\_Soucie](https://forums.developer.nvidia.com/u/John_Soucie)\
**Post date:** [August 7, 2009, 11:12pm UTC](https://forums.developer.nvidia.com/t/cuda-and-static-libraries/11452/3 "2009-08-07T23:12:35Z")

</div>

I appreciate the quick response. I was pretty sure that your response was going to be that there are no static libraries. Is there a short explanation as to why?

Are there any good examples of programming the Driver API? For example, I’ve been using the CUDA boxFilter project for testing. Is there an equivalent box filter example using just the Driver API or something else that is as comprehensive as that example?

---

<div class="post-metadata">

**Author:** ![tmurray](https://developer.download.nvidia.com/images/forums/profile-default-devtalk-84.png) [@tmurray](https://forums.developer.nvidia.com/u/tmurray)\
**Post date:** [August 7, 2009, 11:25pm UTC](https://forums.developer.nvidia.com/t/cuda-and-static-libraries/11452/4 "2009-08-07T23:25:47Z")

</div>

The way CUDART is organized internally doesn’t lend itself well to becoming a static library.

You can look at deviceQueryDrv and other examples like simpleTextureDrv for how to program the driver API. You can use bin2c (included with the toolkit) to easily integrate cubins. The main disadvantage is you don’t get \<\<\<…\>\>\> and have to do some configuration calls before a launch.
