Sign in Join

Live chat for Free Pascal, Lazarus, Delphi and every Pascal programmer.

Mailing lists / lazarus / 2014-05

Illegal typecast in Linux only

5 messages · 3 people ·

Reply by email Subscribe to this list Your subscription

Read-only archive. Use j and k to move between messages.

Richard Mace

Hi,
I am getting the following error: Illegal type conversion: "TObject" to "LongInt" on the following code:

TFSGatewayType(Integer(cbo11TrunkType.Items.Objects[cbo11TrunkType.ItemIndex]))

Is this because I am compiling under Linux 64bit or just Linux or just 64bit? Under Windows 32bit it compiles fine?

Thanks

Richard
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.lazarus.freepascal.org/pipermail/lazarus/attachments/20140501/232a1407/attachment.html>

Reply by email

Mattias Gaertner
to Richard Mace
Show quoted text 8 lines
Hi, I am getting the following error: Illegal type conversion: "TObject" to "LongInt" on the following code: TFSGatewayType(Integer(cbo11TrunkType.Items.Objects[cbo11TrunkType.ItemIndex])) Is this because I am compiling under Linux 64bit or just Linux or just 64bit? Under Windows 32bit it compiles fine?

64bit.
TObject is a 64bit pointer under 64bit.
You can use
TFSGatewayType(PtrUInt(cb...

Mattias

Reply by email

Juha Manninen
to Richard Mace: I am getting the following error: Illegal type conversion: "TObject" to "LongInt" on the…
Richard Mace wrote 7 lines
Hi, I am getting the following error: Illegal type conversion: "TObject" to "LongInt" on the following code: TFSGatewayType(Integer(cbo11TrunkType.Items.Objects[cbo11TrunkType.ItemIndex]))

Typecast to Integer should be PtrInt. It works also on a 64-bit system.

Juha
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.lazarus.freepascal.org/pipermail/lazarus/attachments/20140501/60f86121/attachment.html>

Reply by email

Richard Mace
to Juha Manninen

Thanks Juhu,
Changing my code now :)

Richard

Juha Manninen wrote 22 lines
On Thursday, May 1, 2014, Richard Mace wrote: > Hi, > I am getting the following error: Illegal type conversion: "TObject" to > "LongInt" on the following code: > > > TFSGatewayType(Integer(cbo11TrunkType.Items.Objects[cbo11TrunkType.ItemIndex])) > Typecast to Integer should be PtrInt. It works also on a 64-bit system. Juha -- _______________________________________________ Lazarus mailing list http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.lazarus.freepascal.org/pipermail/lazarus/attachments/20140501/ae43a15a/attachment.html>

Reply by email

Richard Mace
to Mattias Gaertner: On Thu, 1 May 2014 15:04:56 +0100 64bit. TObject is a 64bit pointer under 64bit. You can…

Thanks Mattias,
PtrUInt works like a charm :)

Richard

Mattias Gaertner wrote 26 lines
On Thu, 1 May 2014 15:04:56 +0100 Richard Mace wrote: > Hi, > I am getting the following error: Illegal type conversion: "TObject" to > "LongInt" on the following code: > > TFSGatewayType(Integer(cbo11TrunkType.Items.Objects[cbo11TrunkType.ItemIndex])) > > Is this because I am compiling under Linux 64bit or just Linux or just > 64bit? Under Windows 32bit it compiles fine? 64bit. TObject is a 64bit pointer under 64bit. You can use TFSGatewayType(PtrUInt(cb... Mattias -- _______________________________________________ Lazarus mailing list http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.lazarus.freepascal.org/pipermail/lazarus/attachments/20140501/aa9c03c8/attachment.html>

Reply by email