Unity Plugins for .DLL

Now I writing a simple program with c# and bulding .DLL
(This is the c#)

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

namespace TestDll
{
public class TestClass
{
Queue myQueue = new Queue();
private System.Timers.Timer timerA;
int direction = 0;

    public TestClass()
    {
        timerA = new System.Timers.Timer(100);
        timerA.Elapsed += new System.Timers.ElapsedEventHandler(timerEvent);
        timerA.Enabled = true;
    }

    private void timerEvent(object source, System.Timers.ElapsedEventArgs e)
    {
        myQueue.Enqueue(direction);
        direction = (direction + 1) % 4;
        if (myQueue.Count > 10)
        {
            myQueue.Dequeue();
        }
    }

    public int GetD()
    {
        int r = -1;
        if (myQueue.Count > 0)
        {
            return Convert.ToInt32(myQueue.Dequeue());
        }
        else
        {
            return -1;
        }
    }

    public int iNowMiliSec()
    {
        
        int iRtn = 0;
        try 
        {
            iRtn = DateTime.Now.Millisecond;
        }
        catch (Exception errMsg)
        {
            Debug.WriteLine(errMsg.ToString());
        }
        return iRtn;
    }
}

}

And I put it(DLL) to Unity to test plugins.
I create a c# to import the function in Unity.

using UnityEngine;
using System.Collections;
using System;
using System.Runtime.InteropServices;

public class PluginsTest : MonoBehaviour {

[DllImport ("TestDll")]
private static extern int iNowMiliSec();

[DllImport ("TestDll")]
private static extern int GetD();

void Start () {
Debug.Log(iNowMiliSec());
Debug.Log(GetD());
}

}

But when I play…Unity say…
EntryPointNotFoundException: iNowMiliSec
PluginsTest.Start () (at Assets/PluginsTest/Script/PluginsTest.cs:12)

so…where I miss or wrong??

You shouldn’t have to use DllImport for managed dlls, but unmanaged dlls.

In order to use your TestDll.dll, copy it to Unity as you’ve done. Then your code that uses it should look something like this:

using UnityEngine; 
using System.Collections;
using TestDll;

void Start()
{
    TestClass obj = new TestClass();
    Debug.Log(obj.iNowMiliSec());
    Debug.Log(obj.GetD());    
}