I thought I'd put a small exercise I'm trying to work out fully on here.
Say you are creating a procedure to get input from a hardware device of some kind. Basically to be compatible with Pascal's strong typing, we would have to pass the spot we want the data in as a pointer address so multiple types of data (for Pascal's perspective) can come in.
So we end up with a prototype like:
procedure GetDataFromDevice(var indata: pointer; datasize: longint);
where indata is the pointer, and datasize is the length in bytes of the data to return.
So, you would call it in a main program something like:
GetDataFromDevice(@myvar, sizeof(myvar));
How would you proceed with getting something like this written, instead of having to write a proc for every type and size of data you intend to return?
Say you are creating a procedure to get input from a hardware device of some kind. Basically to be compatible with Pascal's strong typing, we would have to pass the spot we want the data in as a pointer address so multiple types of data (for Pascal's perspective) can come in.
So we end up with a prototype like:
procedure GetDataFromDevice(var indata: pointer; datasize: longint);
where indata is the pointer, and datasize is the length in bytes of the data to return.
So, you would call it in a main program something like:
GetDataFromDevice(@myvar, sizeof(myvar));
How would you proceed with getting something like this written, instead of having to write a proc for every type and size of data you intend to return?