Thursday 25 October 2012

Creating and Using DLL in C# sihle khalala

A dynamic link library (DLL) is a collection of small programs, any of which can be called when needed by a larger program that is running in the computer. The small program that lets the larger program communicate with a specific device such as a printer or scanner is often packaged as a DLL program (usually referred to as a DLL file). DLL files that support specific device operation are known as device drivers.

Definition

dynamic link library (DLL)

A dynamic link library (DLL) is a collection of small programs, any of which can be called when needed by a larger program that is running in the computer. The small program that lets the larger program communicate with a specific device such as a printer or scanner is often packaged as a DLL program (usually referred to as a DLL file). DLL files that support specific device operation are known as device drivers.

//Definition: A DLL file, short for Dynamic Link Library, is a type of file that contains instructions that other programs can call upon to do certain things. This way, multiple programs can share the abilities programmed into a single file.//

DLLs are Dynamic Link Libraries, which means that they're linked into your program at run time instead of build time. There are three parts to a DLL:

*the exports

*the code and data

*the import library

The code and data are the parts you write - functions, variables, etc. All these are merged together, like if you were building one big object files, and put into the dll. They are not put into your .exe at all.

The exports contains a list of functions and variables that the dll makes available to other programs. Think of this as the list of "global" symbols, the rest being hidden. Normally, you'd create this list by hand with a text editor, but it's possible to do it automatically from the list of functions in your code. The dlltool program creates the exports section of the dll from your text file of exported symbols.

The import library is a regular UNIX-like .a library, but it only contains the tiny bit of information needed to tell the OS how your program interacts with ("imports") the dll. This information is linked into your .exe. This is also generated by dlltool.

The advantage of DLL files is that, because they don't get loaded into random access memory (RAM) together with the main program, space is saved in RAM. When and if a DLL file is needed, then it is loaded and run. For example, as long as a user of Microsoft Word is editing a document, the printer DLL file does not need to be loaded into RAM. If the user decides to print the document, then the Word application causes the printer DLL file to be loaded and run.

A DLL file is often given a ".dll" file name suffix. DLL files are dynamically linked with the program that uses them during program execution rather than being compiled with the main program. The set of such files (or the DLL) is somewhat comparable to the library routines provided with programming languages such as C and C++

Example

I received an error message when my computer started up that said I was missing a particular DLL file. After an exhaustive search on the Internet, I found out that I would have to reinstall Windows to fix it!"

///new code

Hi, today i will explain you How to create and manage library(.dll) files in your unity project.


Tools:
1.Unity3D Pro
2.VISUAL C# 2010 EXPRESS or Visual Studio 2010,
3.C# Basic knowledge
4.Brain
5.Hands 8-).


Starting new Project:

Open VISUAL C# 2010 EXPRESS or Visual Studio 2010, go to File>New Project>Visual C#>Class Library. Set Your file name(I named it Tutorial) and Choose(.NET Framework 3.5) not above, otherwise unity will not read .dll.

after setup it will open something like this.

Code:  

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;


namespace Tutorial
{
    public class Class1

    {

    }

}


Ok lets start coding

for more beautifulnes lets change class name (REMEMBER: when you change class name, change also file name in the project) I actualy changing name of the project .cs file name, and it automaticly changing class name for me 8-) .

Now my code will look like this:


Code: select. Line 

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace Tutorial

{

    public class tut

    {

      //code goes here

    }

}


the (namespace Tutorial) will be used in our unity later, it`s mean we must leave it exactly that it or you can change it to other name, for now i will use (namespace Tutorial);

Now i will put some basic function with name "textview" and it will be string. Then i will returne my name.

to construct public function in c# you make it like this (public [string,int,etc...] [function name]() { }).

OK my function is like this

Code: select line 

public string textview()

        {

            return "Mr.Smart";

        }


Now my code will look like this:


Code:  code select

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace Tutorial

{
    public class tut

    {

        public string textview()

        {
            return "Mr.Smart";
        }

    }

}


My dll is ready, i need to build it. go to Build>Configuration Manager... and change debug to release.

your dll must be builded in yourproject\bin\Release folder.

Now go to your Unity project folder and open Assets folder, in that folder make "new folder" called "Plugins".

This will be you plugin folder, paste your.dll to that folder, Unity will automaticly import it.

Usage is very seample open your c# script in your unity project.
Lets say that we make new script and there is nothing.

Blank c# script with class name tutorial.


Code:  code select

using UnityEngine;
using System.Collections;
public class tutorial : MonoBehaviour {

    // Use this for initialization

    void Start () {
    }

    // Update is called once per frame

    void Update () {
    }
}

to get dll work in our script we must make new destination to it.

seamply we will put in upper side "using [your dll file name];" it will automaticly popup if your dll script will not have any error, that is why we didnt delete the "namespace Tutorial" from our dll code.

when we inported dll we must make new variable with the new class of our dll.

for me it will look like

Code: select 1 line

public tut a =  new tut();

t somthing like to make new Vector3 class.

We have imported dll , we have new class. Now we need to call function in our "tut()" class.

it will look like this

Code: select line  

a.textview()

and i will print it in my awake function

Code: select lines  

void Awake(){
        //printing
        print(a.textview());
    }

My code finaly will look like this:

Code: select lines  

using UnityEngine;
using System.Collections;
using Tutorial;
public class tutorial : MonoBehaviour {  
   //making the new class
    public tut a = new tut();
    //on awake
    void Awake(){
        //printing
        print(a.textview());
    }
    // Use this for initialization
    void Start () {
    }
    // Update is called once per frame

    void Update () {
    }
}



Sent from my BlackBerry® wireless device

Monday 1 October 2012

HP announces Windows 8 tablet _ ElitePad 900

HP has announced its latest device,  a 10-inch Windows 8 tablet called the ElitePad 900 aimed at professionals.

The tablet comes wrapped in an aluminium chassis with a Gorilla Glass display.

The tablet, released with a number of accessories, runs an Atom-based Intel Clover Trail processor, with up to 2GB of RAM and up to 64GB of SSD storage. The device also offers approximately 10 hours of run time and optional 3G/4G.

Other features of the device include a screen resolution of 1,280 x 800, 8-megapixel rear camera and a 1080p shooter up front, slots for microSD cards and 3G/4G SIMs.

HP will also be making special smart jackets available with the device that provide additional functionality such as a built in keyboard, removable battery and USB ports.

The ElitePad 900 is expected to go on sale in the U.S. in January 2013.

Source: Engadget
Sent from my BlackBerry® wireless device

B2B Indaba 2012: Connecting Entrepreneurs

The B2B indaba is an informative networking session created for small business entrepreneurs and will be held at the Cape Peninsula University of Technology. The Indaba aims to educate small business entrepreneurs and aspiring entrepreneurs about the importance of creating and maintaining an online presence for their businesses and brands.

The indaba will take place over a period of two hours. This session will include speakers from different business background who have a respectable knowledge of online marketing, small business entrepreneurship and online presence management for businesses and brands.

Each speaker has a maximum of 30 minutes to present on their business, the importance of an online presence for a business and also good entrepreneurship in general.

Attendees will include small business entrepreneurs from Cape Town CBD and surrounding areas, Cape Peninsula University of Technology (CPUT) Entrepreneur students, online media and invited delegates. All attendees will be given an opportunity to comment or ask question related to the speaker's business industry or about online presence management.

The objectives of the Indaba include the following:

Building relationships between businesses and entrepreneurs, and entrepreneurial students.

Informing small business entrepreneurs of the importance of an online presence for their businesses and brands.

Creating networking opportunities for small business entrepreneurs.

More than anything else it is about knowledge transfer, the promotion and support of entrepreneurial growth and development in Cape Town and ultimately South Africa.

Event Details:

When: 6th of October 2012

Time: 11:00 for 11:30 – 13:30

Where: Atrium Room, Cape Peninsula University of Technology

Cost: R100 per person (limited seats available)

To RSVP for this event click here and enter the information below:
Event ID: 1469
Passwords: BBINDABA
Sent from my BlackBerry® wireless device