i have an unmanaged dll written in C++ which has a one simple function.
int temp =0;
int func1(void)
{
return temp +=2;
}
and exported function is
UNMANAGED_DLL1_API int recepret(void)
{
return func1();
}
Then i have a C# project that imports this dll. What I want to do is creating a class that imports dll and creating instances from another class.
class DllClass
{
public int classval;
[DllImport("unmanaged_dll1.dll", EntryPoint = "recepret", CharSet = CharSet.Unicode)]
public static extern int recepret();
public int func1()
{
return recepret();
}
}
And in the Forms Application
public partial class Form1 : Form
{
DllClass dll1 = new DllClass();
DllClass dll2 = new DllClass();
DllClass dll3 = new DllClass();
private void button1_Click(object sender, EventArgs e)
{
richTextBox1.AppendText( "dll1 " + dll1.func1().ToString()+ "\r\n");
}
private void button2_Click(object sender, EventArgs e)
{
richTextBox1.AppendText("dll2 " + dll2.func1().ToString() + "\r\n");
}
private void button3_Click(object sender, EventArgs e)
{
richTextBox1.AppendText("dll3 " + dll3.func1().ToString() + "\r\n");
}
}
but all tree instances are the same. I want independent instances. Is this possible?