Am I compiling a 64 bit or 32 bit system

General FreeBASIC programming questions.
Post Reply
wallyg
Posts: 267
Joined: May 08, 2009 7:08
Location: Tucson Arizona

Am I compiling a 64 bit or 32 bit system

Post by wallyg »

I use the following and get the following output from winfbe

Code: Select all

Command Line: 
C:\FB\FreeBASIC-1.09.0-winlibs-gcc-9.3.0\fbc64.exe -m "C:\EasyGUI\Main.bas" -v -g -s gui -gen GAS64 -maxerr 1024 -e -ex -exx  -x "C:\EasyGUI\Main.exe"

FreeBASIC Compiler - Version 1.09.0 (2021-12-31), built for win64 (64bit)
Copyright (C) 2004-2021 The FreeBASIC development team.
standalone
target:       win64, x86-64, 64bit
backend:      gas64
I am trying to compile a call to screeninfo

Code: Select all

    Dim as Integer pitch
    ScreenInfo ,,,,pitch
And I get the following error

Error 58: Type mismatch at parameter 5 of IMAGEINFOR()

I then tried declaring pitch as a longint as specified in the documentation ( I thought in 64-bit mode Integer and Longint were the same)
and got the same error

I then tried declaring pitch as long and it compiles without any errors.

Do I need to specify something else to indicate that screeninfo should be using 64-bit arguments?
Or am I reading the documentation wrong?
Am I producing a 32-bit executable instead of a 64-bit executable?

Thank you for any guidance in this matter.

Wally
wallyg
Posts: 267
Joined: May 08, 2009 7:08
Location: Tucson Arizona

Re: Am I compiling a 64 bit or 32 bit system

Post by wallyg »

Sorry, I just talked to someone else who informed me that for 64-bit mode, parameters 1 and 2 are required even if I do not care about these values for the 64-bit mode of screeninfo. Strange but I can live with this. I did not think the problem was with screeninfo, I thought I was having a problem producing a 64 bit executable.

Sorry
Wally
fxm
Moderator
Posts: 12081
Joined: Apr 22, 2009 12:46
Location: Paris suburbs, FRANCE

Re: Am I compiling a 64 bit or 32 bit system

Post by fxm »

Or use the LONG (or INTEGER<32>) version of the sub, compatible 32/64-bit (see the SCREENINFO documentation page):

Code: Select all

    Dim as Long pitch
    ScreenInfo ,,,,pitch
storm5510
Posts: 59
Joined: Nov 28, 2019 15:47

Re: Am I compiling a 64 bit or 32 bit system

Post by storm5510 »

It seems to me there would be a default for this. Apparently not. Most data type declarations are 32 and 64 bit. The only strictly 64 bit declaration is ULongInt.
dodicat
Posts: 7976
Joined: Jan 10, 2006 20:30
Location: Scotland

Re: Am I compiling a 64 bit or 32 bit system

Post by dodicat »

Break out your own.

Code: Select all


    Type info
    As Long positionx
    As Long positiony
    As String title
    As Any Ptr handle
    As Long desktopwidth
    As Long desktopheight
    As Long screenwidth
    As Long screenheight
    As Long depth
    As Long bpp
    As Long pitch
    As Long refreshrate
    As String drivername
    As Ulong transparentcolour
    As Ulong foregroundcolour
    As Ulong backgroundcolour
    Declare Constructor
    Declare Operator Cast() As String
   End Type
   
  Constructor info
  Screencontrol 0,positionx,positiony
  Screencontrol 1,title
  Screencontrol 2, *Cptr(Integer Ptr,@handle )
  Screencontrol 3,desktopwidth,desktopheight
  Screencontrol 4, screenwidth,screenheight
  Screencontrol 5, depth
  Screencontrol 6, bpp
  Screencontrol 7, pitch
  Screencontrol 8, refreshrate
  Screencontrol 9, drivername
  Screencontrol 10, transparentcolour
  Screencontrol 13, foregroundcolour,backgroundcolour
  End Constructor

operator info.cast() As String
dim as string s
dim as string x=string(pos-1," ")
#define z   +chr(10)
    s+= "position x"+string(10," ")+str(positionx)z 
    s+= x+"position y"+string(10," ")+str(positiony)z 
    s+= x+"title"+string(15," ")+str(title)z 
    s+= x+"handle"+string(14," ")+str(handle)z 
    s+= x+"desktop width"+string(7," ")+str(desktopwidth)z 
    s+= x+"desktop height"+string(6," ")+str(desktopheight)z 
    s+= x+"screen width"+string(8," ")+str(screenwidth)z 
    s+= x+"screen height"+string(7," ")+str(screenheight)z 
    s+= x+"depth"+string(15," ")+str(depth)z 
    s+= x+"bpp"+string(17," ")+str(bpp)z 
    s+= x+"pitch"+string(15," ")+str(pitch)z 
    s+= x+"refresh rate"+string(20-12," ")+str(refreshrate)z 
    s+= x+"driver name"+string(9," ")+str(drivername)z 
    s+= x+"transparent colour"+string(2," ")+str(transparentcolour)z 
    s+= x+"foreground colour"+string(3," ")+str(foregroundcolour)z 
    s+= x+"background colour"+string(3," ")+str(backgroundcolour)z 
    return s
end operator


Screen 20
windowtitle "Use close box to end ---->"
do
dim as info i
screenlock
cls
print "This screen information:"
locate 9,35
Print i
screenunlock
sleep 10
loop until inkey=chr(255)+"k"



 
coderJeff
Site Admin
Posts: 4313
Joined: Nov 04, 2005 14:23
Location: Ontario, Canada
Contact:

Re: Am I compiling a 64 bit or 32 bit system

Post by coderJeff »

wallyg wrote: May 17, 2022 22:38 Am I producing a 32-bit executable instead of a 64-bit executable?

Code: Select all

#if defined( __FB_64BIT__ )
#print "Producing 64-bit code output"
#else
#print "Producing 32-bit code output"
#endif
As dodicat points out: anything to do with screen sizes and colours you should prefer long/ulong types; they will have a 32-bit size on both 32-bit and 64-bit targets. (When fbc 64-bit support was added, some decisions were made that seemed good at the time, but it caused different problems later, so some statements like screeninfo had some changes last couple of fbc releases.)
Post Reply