[fpc-pascal] How can i detect what cause the problem
Gabor Boros
gaborboros at yahoo.com
Tue Nov 14 13:35:20 CET 2006
Hi,
I have a Symbol mobile device with an integrated barcode scanner.
The scanner's API in C and I cannot use every API calls.
An example: The problem appears in the
ScanBuffer:=SCAN_AllocateBuffer(TRUE,dwScanSize);
line (see the test app below).
If I run in GDB the error message is:
warning: Prefetch Abort: Thread=8dcfe8dc Proc=8c329ab0 'project1.exe'
warning: AKY=00004001 PC=00000000 RA=00011338 BVA=00000000 FSR=000004f0
Program received signal SIGSEGV, Segmentation fault.
0x00000000 in ?? ()
The test app is:
program test;
{$apptype console}
{$PACKRECORDS C}
uses Windows, dynlibs;
const
MAx_SRC=32;
dwScanSize:DWORD=7095;
type
STRUCT_INFO=record
dwAllocated:DWORD;
dwUsed:DWORD;
end;
LABELTYPE = DWORD;
LPSCAN_BUFFER = ^SCAN_BUFFER;
SCAN_BUFFER=record
StructInfo:STRUCT_INFO;
dwDataBuffSize:DWORD;
dwOffsetDataBuff:DWORD;
dwDataLength:DWORD;
dwTimeout:DWORD;
dwStatus:DWORD;
bText:BOOL;
dwLabelType:LABELTYPE;
dwRequestID:DWORD;
TimeStamp:SYSTEMTIME;
dwDirection:DWORD;
szSource:array[0..MAx_SRC-1] of TCHAR;
blsMultiPart:BOOL;
dwScanID:DWORD;
dwBarcodeID:DWORD;
dwNumRemaining:DWORD;
dwOffsetAuxDataBuff:DWORD;
dwAuxDataLength:DWORD;
end;
T_SCAN_AllocateBuffer = function
(bText:BOOL;dwSize:DWORD):LPSCAN_BUFFER; cdecl;
var
SCAN_AllocateBuffer: T_SCAN_AllocateBuffer;
DLL_Handle:TLibHandle;
ScanBuffer:LPSCAN_BUFFER;
begin
DLL_Handle:=LoadLibrary('SCNAPI32.DLL');
Pointer(SCAN_AllocateBuffer):=GetProcedureAddress(DLL_Handle,
'SCAN_AllocateBuffer');
ScanBuffer:=SCAN_AllocateBuffer(TRUE,dwScanSize);
UnloadLibrary(DLL_Handle);
end.
Thanks!
Gabor
More information about the fpc-pascal
mailing list