User Profile
Collapse
-
unfortunately default parameters are not supported by C# before 4.0... -
sorry..it's my foolishness..th e functions that is imported has default values...like unsigned char ReaderAddr = 0xff..for this imported function, i have written an overloaded one..does the compiler give any error??
P.S. i haven't tried to communicate the RFID reader yet..before all else i have tried to figure out the DLL...Leave a comment:
-
dennisoleksyuk,
thanks for your explanation..it 's very clear..i have tried to call my DLL into C# for months..i have seen very miscellaneous examples to marshal the function parameters..but yours is very simple..for example i have done it like
Code:[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Ansi)] public struct TagIds { public byte TagType; public byte
Leave a comment:
-
btw i'm not the writer of this DLL..
Code:[DllImport("TestDriver.dll", CallingConvention = CallingConvention.StdCall, EntryPoint = "?DrfIsoMultiTagIdentify@@YGFKPAIPAUTagIds@@E@Z")]
that you have created..can you clarify it for me please??Leave a comment:
-
and the C header file for the functions that i am trying to call is
Code:typedef struct { unsigned char TagType; unsigned char AntNum; unsigned char Ids[12]; }TagIds; typedef short apiStatus; apiStatus __declspec(dllexport) __stdcall DrfCommOpen (HANDLE * hCom, char *com_port); apiStatus __declspec(dllexport) __stdcall DrfCommClose (HANDLE hCom); apiStatus
Leave a comment:
-
-
Code:__declspec(dllexport) __stdcall short DrfIsoMultiTagIdentify(HANDLE hCom, unsigned int * Count,TagIds *value, unsigned char ReaderAddr);
Code:if(DrfIsoMultiTagIdentify(ComHandle,&Cnt,TagData,0Xff)==0) { for(i = 0; i < Cnt; i++) OutputDate(TagData[i]); }
Last edited by tlhintoq; Jan 31 '10, 04:30 PM. Reason: [CODE] ...Your code goes between code tags [/CODE]Leave a comment:
-
for example;
Code:typedef struct { unsigned char TagType; unsigned char AntNum; unsigned char Ids[12]; }TagIds; /***************C# Convert**********************/ [StructLayout(LayoutKind.Sequential, CharSet = CharSet.Ansi)] public struct TagIds { public byte TagType; public byte AntNum;
Last edited by tlhintoq; Jan 31 '10, 04:30 PM. Reason: [CODE] ...Your code goes between code tags [/CODE]Leave a comment:
-
need help importing the native DLL??
Hi,
i have a native or an unmanaged DLL that i will use this DLL to conrol an external device and i have tried to call it into c# but i have trouble with non-Blittable types...i have tried marshal these types but i'm not sure whether i achieved it..??
thanks in advance
Suzan
No activity results to display
Show More
Leave a comment: