PlanetSquires Forums

Please login or register.

Login with username, password and session length
Advanced search  
Pages: 1 [2]

Author Topic: FB 1.07  (Read 1038 times)

Josť Roca

  • Moderator
  • Guru Member
  • *****
  • Posts: 3200
Re: FB 1.07
« Reply #15 on: August 28, 2019, 04:16:07 PM »

Here is a first try at the integration:  https://www.planetsquires.com/files/WinFBE_Suite_107.rar

I tried a few compiles. Simple source code files seemed to compile okay for 32 and 64, but more involved source codes failed with various syntax errors. I need to read up on the big changes, or maybe there is a difference between the old 1.06 *inc files and the new 1.07 inc files.


This new version works fine.

> but more involved source codes failed with various syntax errors

Any example that I can test?

Paul Squires

  • Administrator
  • Guru Member
  • *****
  • Posts: 8848
  • Windows 10
    • PlanetSquires Software
Re: FB 1.07
« Reply #16 on: August 28, 2019, 04:43:26 PM »

Attached is a simple employee database program that I wrote to help me at work. It seems to compile for 32 bit but fails with 64 bit. I haven't done much investigating yet as to why. I removed all of the employee data from the sqlite database so I feel okay posting it here.

(EDIT: Attachment removed as it is no longer needed)
« Last Edit: September 01, 2019, 02:21:01 PM by Paul Squires »
Logged
Paul Squires
PlanetSquires Software
WinFBE Editor and Visual Designer

Josť Roca

  • Moderator
  • Guru Member
  • *****
  • Posts: 3200
Re: FB 1.07
« Reply #17 on: August 28, 2019, 06:46:19 PM »

Most are problems of incorrect casting (each version of the pompiler is more strict)

Code: [Select]
nIndex = frmEmployees.lstEmployees.Items.Add( pStmt.ColumnText(wszColumnName), cast(long, pData) )
--- must be
nIndex = frmEmployees.lstEmployees.Items.Add( pStmt.ColumnText(wszColumnName), cast(INTEGER, pData) )

dim pData as longint ptr = cast(longint ptr, frmSetup.lstData.SelectedItem.Data32)
--- must be
dim pData as longint ptr = cast(longint ptr, CAST(INTEGER, frmSetup.lstData.SelectedItem.Data32))

if combo.SelectedIndex > -1 then pData = cast(CWSTR ptr, combo.SelectedItem.Data32)
--- must be
if combo.SelectedIndex > -1 then pData = cast(CWSTR ptr, CAST(INTEGER, combo.SelectedItem.Data32))

frmSetup.lstData.Items.Add( pStmt.ColumnText(wszColumnName), cast(long, pData) )
--- must be
frmSetup.lstData.Items.Add( pStmt.ColumnText(wszColumnName), cast(long, CAST(INTEGER, pData)) )

They have also modified windowsx.bi

Code: [Select]
nIndex = ComboBox_FindStringExact( frmSetup.comboLevel.hWindow, -1, pStmt.ColumnText("grouplevel") )
--- must be
nIndex = ComboBox_FindStringExact( frmSetup.comboLevel.hWindow, -1, STRPTR(pStmt.ColumnText("grouplevel") ) )

I haven't yet found the correct syntax for DELETE.

Josť Roca

  • Moderator
  • Guru Member
  • *****
  • Posts: 3200
Re: FB 1.07
« Reply #18 on: August 28, 2019, 06:57:12 PM »

For DELETE it seems that you will need an intermediate step:

Code: [Select]
delete cast(sqlite3_int64 ptr, CAST(INTEGER, combo.Item(i).Data32))

--- change to:

DIM p AS INTEGER PTR = CAST(INTEGER PTR, CAST(INTEGER, combo.Item(i).Data32))
DELETE p

Code: [Select]
delete cast(LONGINT ptr, frmSubstantive.lstTeams.Item(i).Data32)

--- change to:

DIM p AS INTEGER PTR = CAST(INTEGER PTR, CAST(INTEGER, frmSubstantive.lstTeams.Item(i).Data32))
DELETE p

Josť Roca

  • Moderator
  • Guru Member
  • *****
  • Posts: 3200
Re: FB 1.07
« Reply #19 on: August 28, 2019, 07:00:19 PM »

Too many pointers stored as longs, and longs stored as pointers...

Paul Squires

  • Administrator
  • Guru Member
  • *****
  • Posts: 8848
  • Windows 10
    • PlanetSquires Software
Re: FB 1.07
« Reply #20 on: August 28, 2019, 08:07:44 PM »

Thanks Jose, I made all of the changes and got it to compile. This application only runs in 32 bit because I am using 32 bit DLL's for sqlite and libharu. Hopefully the resulting 64 bit exe is actually a good exe.

All of the CAST's are because in my WinFormsX library I have a generic LONG value for most items (ie the Data32 property of a combobox item, etc). I was using that area to store pointers to larger structures (sqlite 64 bit pointers). It is a pain to have to do the CAST to and from INTEGER. It seems that you only need that in the 64 bit compiles. The 32 bit compiles did not need the CAST's or changes to the DELETE.
Logged
Paul Squires
PlanetSquires Software
WinFBE Editor and Visual Designer

Josť Roca

  • Moderator
  • Guru Member
  • *****
  • Posts: 3200
Re: FB 1.07
« Reply #21 on: August 29, 2019, 03:23:00 PM »

In the 32 compilers, the size of pointers and longs are the same, but in the 64-bit compilers not. Therefore, you must make sure that both are the same size. I have used INTEGER because it evaluates as 32-bit or 64-bit. In 32-bit you don't need CAST(INTEGER, combo.Item(i).Data32)), because it will cast a long to a long, which is redundant, but in 64 bit we need to cast the 32-bit value to a 64-bit value. Keep in mind that the 32-bit compiler uses gas (an assembler) by default, whereas the 64-bit compiler uses gcc, which is a c++ compiler with strict type checking.
Pages: 1 [2]