Programming Manual
PHYTEC Messtechnik GmbH 2008 L-720e_0
87
P
ro
g
ra
m
m
in
g
M
a
n
u
a
l
6.2.6
Programming under Delphi
In order to utilize the pciGrabber-4x4 with Borland Delphi for user
applications, the driver-DLL with function export
“G
R
4C
DLL
.
DLL
“
should be employed.
To introduce the functions to the DLL in Delphi a corresponding
Unit
has to be defined. Please pay attention to the correct calling sequence,
to guarantee the compatibility of the DLL. Define the functions with
the type
stdcall
. In case of false declarations stack-overflows or -
underflows can occur, which will cause a violation against protected
areas. In the following example a unit is defined:
unit grab4dll;
interface
{ The calling sequence 'stdcall' defines the sequence of the pa-
rameter transfer to the stack and signals to Delphi that the
called function frees the stack region, which was used for the pa-
rameter }
function Grab4_Get_Error: word;
stdcall; external 'gr4cdll.dll' name 'Get_Error';
function Grab4_Max_Device_Number: word;
stdcall; external 'gr4cdll.dll' name
'Max_Device_Number';
function Grab4_Data_Present(nDevNo: word): word;
stdcall; external 'gr4cdll.dll' name 'Data_Present';
function Grab4_GetPictureBufferAddress(nDevNo: word;
dwBitsSize: Cardinal): cardinal;
stdcall; external 'gr4cdll.dll' name 'Data_Present';
procedure Grab4_Initialize(nDevNo: word);
stdcall; external 'gr4cdll.dll' name 'Initialize';
procedure Grab4_Set_Channel(nDevNo, nChannel: word);
stdcall; external 'gr4cdll.dll' name 'Set_Channel';
procedure Grab4_Start_Grabber(nDevNo: word);
stdcall; external 'gr4cdll.dll' name 'Start_Grabber';
procedure Grab4_Stop_Grabber(nDevNo: word);
stdcall; external 'gr4cdll.dll' name 'Stop_Grabber';