# c# with cuda c# can call a cuda dll file?

**URL:** <https://forums.developer.nvidia.com/t/c-with-cuda-c-can-call-a-cuda-dll-file/3763>\
**Category:** CUDA Programming and Performance\
**Created:** [May 19, 2008, 1:22am UTC](https://forums.developer.nvidia.com/t/c-with-cuda-c-can-call-a-cuda-dll-file/3763 "2008-05-19T01:22:21Z")\
**Posts on this page:** 8\
**Page:** 1

<div class="post-metadata">

**Author:** ![Quoc\_Vinh](https://developer.download.nvidia.com/images/forums/profile-default-devtalk-84.png) [@Quoc\_Vinh](https://forums.developer.nvidia.com/u/Quoc_Vinh)\
**Post date:** [May 19, 2008, 1:22am UTC](https://forums.developer.nvidia.com/t/c-with-cuda-c-can-call-a-cuda-dll-file/3763/1 "2008-05-19T01:22:21Z")

</div>

Hi Guys  
I have a question that  
first we make some cuda functions and then build it to dll file  
second shall we make a new c# project to call the cuda function on dll file  
so we can use C# to make to program for computer interface (easier than C++)  
and we can get the capacity of CUDA

Now in my computer, I don’t have c# so I can not try to do it  
Does anybody has tried to do it, can you tell me that it can work.

---

<div class="post-metadata">

**Author:** ![lokiman](https://developer.download.nvidia.com/images/forums/profile-default-devtalk-84.png) [@lokiman](https://forums.developer.nvidia.com/u/lokiman)\
**Post date:** [May 19, 2008, 3:36am UTC](https://forums.developer.nvidia.com/t/c-with-cuda-c-can-call-a-cuda-dll-file/3763/2 "2008-05-19T03:36:49Z")

</div>

Hello!

This exactly what i am doing and it is working! :D

GUI under .NET via C# and rendering/computing core via CUDA in external DLL…

Everything works ok but when i compile Emu\_Debug mode i just can’t trace into any of my dll function :( Pdb file should be ok but maybe I am just too lame with those C# things :D

C++ and WIN32 forever! :P

---

<div class="post-metadata">

**Author:** ![Neeraj](https://developer.download.nvidia.com/images/forums/profile-default-devtalk-84.png) [@Neeraj](https://forums.developer.nvidia.com/u/Neeraj)\
**Post date:** [May 19, 2008, 5:05am UTC](https://forums.developer.nvidia.com/t/c-with-cuda-c-can-call-a-cuda-dll-file/3763/3 "2008-05-19T05:05:44Z")

</div>

> [@](#):
>
> Hi Guys
> 
> I have a question that
> 
> first we make some cuda functions and then build it to dll file
> 
> second shall we make a new c# project to call the cuda function on dll file
> 
> so we can use C# to make to program for computer interface (easier than C++)
> 
> and we can get the capacity of CUDA
> 
> Now in my computer, I don’t have c# so I can not try to do it
> 
> Does anybody has tried to do it, can you tell me that it can work.
> 
> [snapback]379157[/snapback]

Deploying CUDA library as a COM component makes sense. Instead of packaging the CUDA library as simple C DLL , deploy it as a COM component. You will be able to access your code through tons of languages and scripts and through different machines too.

Cheers,

Neeraj

---

<div class="post-metadata">

**Author:** ![Quoc\_Vinh](https://developer.download.nvidia.com/images/forums/profile-default-devtalk-84.png) [@Quoc\_Vinh](https://forums.developer.nvidia.com/u/Quoc_Vinh)\
**Post date:** [May 19, 2008, 7:29am UTC](https://forums.developer.nvidia.com/t/c-with-cuda-c-can-call-a-cuda-dll-file/3763/4 "2008-05-19T07:29:33Z")

</div>

Thank you Neeraj and lokiman [External Image](http://hqnveipbwb20/public/style_emoticons/<#EMO_DIR#>/heart.gif "Image hosted on another site. Click to open in a new tab.")

Your Idea is helpful for me. Now I will download C# express to use it :D

---

<div class="post-metadata">

**Author:** ![theperm](https://developer.download.nvidia.com/images/forums/profile-default-devtalk-84.png) [@theperm](https://forums.developer.nvidia.com/u/theperm)\
**Post date:** [June 12, 2008, 9:01am UTC](https://forums.developer.nvidia.com/t/c-with-cuda-c-can-call-a-cuda-dll-file/3763/5 "2008-06-12T09:01:35Z")

</div>

I was wondering if you would be willing to share your C# wrapper to CUDA?

Im interested in using CUDA for non graphics applications but I’m not sure how I can utilise it yet. I wouldn’t like to spend to much time wrapping it up in C# to find it is not of much use to me.

> [@](#):
>
> Hello!
> 
> This exactly what i am doing and it is working! :D
> 
> GUI under .NET via C# and rendering/computing core via CUDA in external DLL…
> 
> Everything works ok but when i compile Emu\_Debug mode i just can’t trace into any of my dll function :( Pdb file should be ok but maybe I am just too lame with those C# things :D
> 
> C++ and WIN32 forever! :P
> 
> [snapback]379197[/snapback]

---

<div class="post-metadata">

**Author:** ![raxen](https://developer.download.nvidia.com/images/forums/profile-default-devtalk-84.png) [@raxen](https://forums.developer.nvidia.com/u/raxen)\
**Post date:** [February 19, 2010, 6:45pm UTC](https://forums.developer.nvidia.com/t/c-with-cuda-c-can-call-a-cuda-dll-file/3763/6 "2010-02-19T18:45:25Z")

</div>

Huh, this is actually what I am working on as well. Maybe we should all collaborate on these open issues to create some concrete code for the community.

---

<div class="post-metadata">

**Author:** ![Ailleur](https://developer.download.nvidia.com/images/forums/profile-default-devtalk-84.png) [@Ailleur](https://forums.developer.nvidia.com/u/Ailleur)\
**Post date:** [February 20, 2010, 12:41am UTC](https://forums.developer.nvidia.com/t/c-with-cuda-c-can-call-a-cuda-dll-file/3763/7 "2010-02-20T00:41:59Z")

</div>

For stepping into the dll you need to enable “enable unmanaged code debugging” inside the c# project properties.  
For how to work with a c# and c++ dll in general, see my response in [url=“[http://forums.nvidia.com/index.php?showtopic=159708](http://forums.nvidia.com/index.php?showtopic=159708)”][http://forums.nvidia.com/index.php?showtopic=159708[/url]](http://forums.nvidia.com/index.php?showtopic=159708%5B/url%5D)

---

<div class="post-metadata">

**Author:** ![You7878](https://developer.download.nvidia.com/images/forums/profile-default-devtalk-84.png) [@You7878](https://forums.developer.nvidia.com/u/You7878)\
**Post date:** [February 20, 2010, 6:50am UTC](https://forums.developer.nvidia.com/t/c-with-cuda-c-can-call-a-cuda-dll-file/3763/8 "2010-02-20T06:50:11Z")

</div>

How about [url=“[http://www.hoopoe-cloud.com/Solutions/CUDA.NET/Default.aspx](http://www.hoopoe-cloud.com/Solutions/CUDA.NET/Default.aspx)”][http://www.hoopoe-cloud.com/Solutions/CUDA.NET/Default.aspx[/url]](http://www.hoopoe-cloud.com/Solutions/CUDA.NET/Default.aspx%5B/url%5D)? I am currently using it and it looks fine to me.
