On Tue, 14 Nov 2006, Gabor Boros wrote:
> 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; I would be very surprised to see that a Windows DLL uses cdecl; as calling convention. Try changing this to T_SCAN_AllocateBuffer = function (bText:BOOL;dwSize:DWORD):LPSCAN_BUFFER; stdcall; Michael. _______________________________________________ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/mailman/listinfo/fpc-pascal