Tutorials Navigation
[C#] How to make your own .DLL function library
Tutorial Name: [C#] How to make your own .DLL function library
Category: PC Tutorials
Submitted By: Skittle
Date Added:
Comments: 0
Views: 1,969
Related Forum: PC Building Forum
Share:
In this tutorial I will be showing you how to compile functions into a .DLL file that you can distribute for others to use.
For my example, my .DLL will have one function that adds two numbers together and returns the value.
First, you will need to create your project. Open up Visual Studio.
Click "New Project":
Select "Class Library", name it to whatever you want and press "Ok":
Once your project has been created, you will come to the screen where you will put your code:
The code for my function will be very simple; The user will pass two Integers, they will be added together and returned. Here is my code:
public int Add(int num1, int num2)
{
return num1 + num2;
}
All you have to do is add your code into the main Class:
If I wanted to add more functions, all I would have to do is repeat:
I know that these functions are completely pointless, but they are just an example of what you can do.
Next, you will need to build your project into a .DLL file. This is slightly different to a normal program, you do not run it like an application, otherwise you will get this message:
This is because running the program will not open a form, or run a console window, it just stores procedures that are accessed by other programs. You need to Build the project. Go to the "Build" tab at the top, and click "Build Solution" (or use the KeyBind CTRL+SHIFT+B):
Your program has been successfully compiled into a .DLL library!
To find the newly-created file, go to your project folder and find it at "\bin\Debug\YourDLL.dll":
I will soon be adding another tutorial on how to use a .DLL as a reference in one of your programs.
If you need any help with, feel free to PM me
Ratings
Comments
Related Tutorials
- 01. Emulating Xbox 360 on PC for Running COD4 With Mods(3,709)
- 02. How to: Matrix Numbers | Batch File(1,964)
- 03. How to Password Protect Files on Windows(874)
- 04. How to play Socom 2/3/ and Combined Assault on PC(6,937)
- 05. Modern Warfare 2 Vac Ban Bypass Tutorial(6,282)
- 06. How to embed an image on TheTechGame(3,151)
- 07. [PC] NIOH 2 OTHER USER SAVE RESIGN(13,104)
- 08. Host bot lobbies! Full Tutorial!(11,675)
- 09. Unban yourself [Plutonium BO2](14,328)
- 10. Fall Guys - How to Change Your Name Color on Fall Guys(8,422)
- 11. Best Crosshair Settings for Valorant(6,565)
- 12. Othercide The Surgeon Boss Guide(2,577)
- 13. Othercide Remembrances Unlock Guide(4,529)
- 14. Othercide Beginners Tips and Tricks(2,746)
- 15. How to Fix Grounded Crashes, Loading Time, Low FPS and Other(4,899)
"[C#] How to make your own .DLL function library" :: Login/Create an Account :: 0 comments