A
Arda Han
I am migrating my some applications from Delphi to C#. But...
Yes But I don't know C# professionally. I am using DLL in delphi like this :
.....
const
RFID_103_485IO = 'Cihaz.dll';
Function SearchPort (Prm1:LongWord) :LongWord; cdecl; External
RFID_103_485IO name 'SearchPort';
Function CheckPort (Prm1:LongWord) :LongWord; cdecl; External
RFID_103_485IO name 'CheckPort';
Function SearchReader (Prm1:LongWord; Prm2:LongWord) :LongWord; cdecl;
External RFID_103_485IO name 'SearchReader';
Function CheckReader (Prm1:LongWord; Prm2:LongWord) :LongWord; cdecl;
External RFID_103_485IO name 'CheckReader';
....
I am using it in Delphi :
.....
ResultNumber := CheckReader(n, m);
....
But how can I use my DLL functions in C#. I am trying below code in my
class. But it doesn't work. Could you help me ?
using System;
using System.Runtime.InteropServices;
namespace MyDllLoadClass
{
public class Reader
{
[DllImport("Cihaz.dll", CallingConvention=CallingConvention.Cdecl)]
static extern void SearchPort (uint Prm1);
[DllImport("Cihaz.dll", CallingConvention=CallingConvention.Cdecl)]
static extern int CheckPort (uint Prm1);
[DllImport("Cihaz.dll", CallingConvention=CallingConvention.Cdecl)]
static extern void SearchReader (uint Prm1, uint Prm2);
}
}
I am trying using this in my other class
label1.Text = Convert.ToString(MyDllLoadClass.Reader.CheckPort(i));
Yes But I don't know C# professionally. I am using DLL in delphi like this :
.....
const
RFID_103_485IO = 'Cihaz.dll';
Function SearchPort (Prm1:LongWord) :LongWord; cdecl; External
RFID_103_485IO name 'SearchPort';
Function CheckPort (Prm1:LongWord) :LongWord; cdecl; External
RFID_103_485IO name 'CheckPort';
Function SearchReader (Prm1:LongWord; Prm2:LongWord) :LongWord; cdecl;
External RFID_103_485IO name 'SearchReader';
Function CheckReader (Prm1:LongWord; Prm2:LongWord) :LongWord; cdecl;
External RFID_103_485IO name 'CheckReader';
....
I am using it in Delphi :
.....
ResultNumber := CheckReader(n, m);
....
But how can I use my DLL functions in C#. I am trying below code in my
class. But it doesn't work. Could you help me ?
using System;
using System.Runtime.InteropServices;
namespace MyDllLoadClass
{
public class Reader
{
[DllImport("Cihaz.dll", CallingConvention=CallingConvention.Cdecl)]
static extern void SearchPort (uint Prm1);
[DllImport("Cihaz.dll", CallingConvention=CallingConvention.Cdecl)]
static extern int CheckPort (uint Prm1);
[DllImport("Cihaz.dll", CallingConvention=CallingConvention.Cdecl)]
static extern void SearchReader (uint Prm1, uint Prm2);
}
}
I am trying using this in my other class
label1.Text = Convert.ToString(MyDllLoadClass.Reader.CheckPort(i));