+ Reply to Thread
Results 1 to 2 of 2

Thread: creating your own DLL Library and using it as API

  1. #1
    Junior Member
    Join Date
    Jan 2012
    Posts
    15

    creating your own DLL Library and using it as API

    I'd like to create my own DLL that has all kind of functions i may need.

    Is it possible to create a DLL and how it works ?
    Last edited by white; 11-02-2012 at 12:22 PM.

  2. #2
    Junior Member
    Join Date
    May 2012
    Posts
    10
    After that tutorial you should be able to create your Own DLL and use it as an API

    Creating the project :
    1- Open Visual Studio or c# Express
    2- Choose Class Library from Projects
    3- Give it a name and click OK

    Using the Library as an API :
    1- inserting a simple code to print "I Love CodeExperts"
    2- Building the Application
    3- Importing it into another Application

    Coding :
    --------
    Code:
    using System;
    using System.Collections.Generic;
    using System.Text;
    
    namespace LibOnTheGo
    {
        public class Class1
        {
            public void Print()
            {
                Console.WriteLine("I Love CodeExperts");
            }
        }
    }
    To Build the DLL just press the CTRL + F5 both together in the same time , an Error message will pop up but it is fine now you have built the DLL

    Insert it into Appliation :
    I have created a test console application as the function provides a Console.WriteLine so we will use a console application
    Steps :
    a) Copy the LibraryFileName.dll from debug folder to the debug folder of the console application
    b) Solution Explorer >> Refrences >> RighClick and choose Add Reference >> Browse and choose the LibraryFileName.dll
    c) Now use the namespace :
    Code:
    using LibraryFileName;
    Main will be :
    Code:
            public static void Main()
            {
                Class1 c = new Class1();
                c.Print();
            }
    The Result will be : I Love CodeExperts

+ Reply to Thread

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts