Here is my question..
I created a c language console application to read and write NFC card. In there, there are 2 functions for read and write.
long ReadCard(char * cID)
{
// code here
}
long WriteCard(char * cID)
{
// code here
}
to call this function , i used this code..
for read card..
char * cID = malloc(17 * sizeof(char));
long _ret = ReadCard(cID);
for write card..
char CID[17];
printf("Enter Card ID \n");
scanf("%s", CID);
long _ret = WriteCard(CID);
this is perfectly working...
then i created a dll using above console application and tried to use it in a c# application..
In c# code first i import dll and function declared like this..
[DllImport("NFC_Driver_DLL.dll", CallingConvention = CallingConvention.Cdecl)]
public static extern int ReadCard([Out] char[] cID);
[DllImport("NFC_Driver_DLL.dll", CallingConvention = CallingConvention.Cdecl)]
public static extern int WriteCard([In] char[] cID);
after that , in order to read card, I used this code..
char[] CardID = new char[17];
int a = ReadCard(CardID);
string s = new string(CardID);
MessageBox.Show(s);
this is fully tested and 100% working..
but i don't know, how to call write card function from c# side..
i tried this code...
char[] CardID = new char[17] ;
int a = WriteCard(CardID);
when executing this code, it occurs a exception which tell this message..
An unhandled exception of type 'System.EntryPointNotFoundException' occurred in WpfNFCTest.exe
Additional information: Unable to find an entry point named 'WriteCard' in DLL 'NFC_Driver_DLL.dll'.
please help me to call this write function please...