Delphi-PRAXiS

Delphi-PRAXiS (https://www.delphipraxis.net/forum.php)
-   Datenbanken (https://www.delphipraxis.net/15-datenbanken/)
-   -   Delphi UDF Lazarus 64Bit (https://www.delphipraxis.net/139978-udf-lazarus-64bit.html)

Gruber_Hans_12345 9. Sep 2009 14:25

Datenbank: Firebird • Version: 2.1.2 • Zugriff über: UDF

UDF Lazarus 64Bit
 
Hallo

Meine UDF für 64Bit funktioniert unter 64Bit Server nicht richtig, habe einfach den gelichen Quellcode genommen wie für 32 Bit, aber ich bekomme als Result immer NULL raus.

Muß ich hier irgendwo was umbasteln, sprich bekomme ich irgendwo 64Bit werte in den Aufruf der UDF, wo normalerweise 32Bit sein sollten?

das sind die typen die verwendet werden ...
Delphi-Quellcode:
type
  Int                 = LongInt; // 32 bit signed
  UInt                = DWord;  // 32 bit unsigned
  Long                = LongInt; // 32 bit signed
  ULong               = DWord;  // 32 bit unsigned
  Short               = SmallInt;// 16 bit signed
  UShort              = Word;   // 16 bit unsigned
  Float               = Single; // 32 bit
  UChar               = Byte;   // 8 bit unsigned
  ISC_LONG            = Long;   // 32 bit signed
  UISC_LONG           = ULong;  // 32 bit unsigned
  ISC_STATUS          = Long;   // 32 bit signed
  UISC_STATUS         = ULong;  // 32 bit unsigned
  Void                = Pointer;
  // Delphi "Pointer types"
  PPChar              = ^PChar;
  PSmallInt           = ^SmallInt;
  PInt                = ^Int;
  PInteger            = ^Integer;
  PShort              = ^Short;
  PUShort             = ^UShort;
  PLong               = ^Long;
  PULong              = ^ULong;
  PFloat              = ^Float;
  PUChar              = ^UChar;
  PVoid               = ^Pointer;
  PDouble             = ^Double;
  PISC_LONG           = ^ISC_LONG;
  PUISC_LONG          = ^UISC_LONG;
  PISC_STATUS         = ^ISC_STATUS;
  PPISC_STATUS        = ^PISC_STATUS;
  PUISC_STATUS        = ^UISC_STATUS;

himitsu 9. Sep 2009 15:02

Re: UDF Lazarus 64Bit
 
Delphi-Quellcode:
Int                 = Int64;   // 64 bit signed
UInt                = UInt64;  // 64 bit unsigned
PInt                = PInt64;
oder
Delphi-Quellcode:
Int                 = Integer;   // 32/64 bit signed
UInt                = Cardinal;  // 32/64 bit unsigned
PInt                = PInteger;
Letzeres nutzt den standardtypen des Compilers ... also bei einem 32-Bit-Compiler LongInt und bei einem 64-Bit-Compiler Int64.

FAlter 9. Sep 2009 15:23

Re: UDF Lazarus 64Bit
 
Hi,

das dachte ich auch, bis ich feststellen musste, dass in meinem Lazarus Win64 ein Integer auch nur 32 Bit groß ist (bzw. ein sizeof(Integer) liefert eine 4).

Gruß
Felix

himitsu 9. Sep 2009 15:26

Re: UDF Lazarus 64Bit
 
Und da sagen alle noch, daß Lazarus sooooo super sei :roll:

Gruber_Hans_12345 9. Sep 2009 15:29

Re: UDF Lazarus 64Bit
 
das habe ich auch schon irgendwo gelesen, aber mein problem ist, das ich nicht weiss was Firebird in der UDF nun genau haben möchte ... 32Bit, 64Bit, 16Bit ?!?!

FAlter 9. Sep 2009 15:47

Re: UDF Lazarus 64Bit
 
Hi,

guck mal ob irgendwelche Pointer gecastet werden. Pointer sind natürlich 64 Bit groß auf nem 64 Bit System.

http://wiki.freepascal.org/Integer schreibt:
FPC currently uses 32 bits (4 bytes) for integers, whether the machine is a 32-bit or 64-bit machine. This will cause code expecting an integer and a pointer to be the same size to fail as a 64-bit machine uses 64-bit pointers. To allow you to write portable code, the FPC system unit introduces the types PtrInt and PtrUInt which are signed and unsigned integer data types with the same size as a pointer.


Gruß
Felix

Gruber_Hans_12345 9. Sep 2009 16:00

Re: UDF Lazarus 64Bit
 
also, läuft jetzt, komischeweise mußte ich einen rückgabewert, der vorher integer war, nun auf word umändern .... keine ahnung warum kommt mir sehr merkwürdig vor

Aber es geht auf jeden fall nun.


Alle Zeitangaben in WEZ +1. Es ist jetzt 21:15 Uhr.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
LinkBacks Enabled by vBSEO © 2011, Crawlability, Inc.
Delphi-PRAXiS (c) 2002 - 2023 by Daniel R. Wolf, 2024 by Thomas Breitkreuz