I am trying to write some functions for a dll which means I need to declare the function, and call the function - sorry im not very good at these!
I have an example piece of code which was written in C++ and this is how it calls the function
RDR_SendCommandGetData(reader_handle, "select", "", buffer);
I have details on how what the functions requires here
RDR_SendCommandGetData // this is the function name
The RDR_SendCommandGetData function sends a command to a reader specified by its
handle and receives data.
Win char* RDR_SendCommandGetData(void* hReader, char* command, char* / this is some kind of declaration or description on the function
data, char* buffer);
Parameter Description // next are the defination of the variables required.
hReader: Handle of reader to send a command.
command: 0 terminated string with the command e,g one of the commands I know is "select"
data: ASCII 0 terminated string containing the data
BIN length of data (1 byte) + data // note when using the select command there is no data
buffer: A buffer of the return value.
ASCII protocol: The buffer size has the range of 514 bytes.
BIN protocol: The buffer size has the range of 256 bytes.
I am getting confused with the char variable types and think they need to be pointers or something like that, I have put my code below but please appreciate it is wrong as I have been trying allsorts
function RDR_SendCommandGetData(readerhandle:integer;command:pointer;data:pointer;cardid:pointer):integer; stdcall; external 'Reader.dll' name 'RDR_SendCommandGetData'; // gets card ID
Im trying to call it as follows
readcard := RDR_SendCommandGetData(readerhandle, @command,@buffer,@cardid);
I have set command,buffer, and cardid as string type variables.
I really appreciate any help as my normal programmer is on leave and Im trying to sort this on my own (fat chance without you guys!)