January 22, 2019, 06:08:23 PM

Author Topic: No chances to see "?Win64" on Blitzmax NG?  (Read 334 times)

Offline fielder

  • Jr. Member
  • **
  • Posts: 52
No chances to see "?Win64" on Blitzmax NG?
« on: December 15, 2018, 07:57:43 PM »
Code: [Select]
?MacOS
Import BRL.glmax2d
Import brl.freeaudioaudio
?Win32
Import brl.d3d9max2d
Import brl.directsoundaudio
Import "scheduler.o"
?Win64
Import brl.d3d9max2d
Import brl.directsoundaudio
Import "scheduler64.o" <-------------
?Linux
Import BRL.glmax2d
Import brl.freeaudioaudio
Import "-ldl"
?

Offline GW

  • Full Member
  • ***
  • Posts: 151
Re: No chances to see "?Win64" on Blitzmax NG?
« Reply #1 on: December 15, 2018, 08:23:13 PM »
What's your question?   'win64' is a valid identifier.

Offline Derron

  • Hero Member
  • *****
  • Posts: 1557
Re: No chances to see "?Win64" on Blitzmax NG?
« Reply #2 on: December 15, 2018, 10:05:50 PM »
To make it use "win64" you need to set the compiler options (in MaxIDE or command line) to use the 64bit target rather than the 32bit one.


bye
Ron

Offline fielder

  • Jr. Member
  • **
  • Posts: 52
Re: No chances to see "?Win64" on Blitzmax NG?
« Reply #3 on: December 15, 2018, 10:25:55 PM »
Thanks again Derron for your support...
the issue.. is that the ?win32 section is used on win64 builds... the "scheduler.o" file throw an error during build (it's designed for 32 bit builds)...

the error is:  skipping incompatible --> cannot find

Code: [Select]
C:/BlitzMaxNG/MinGW32x64/bin/../lib/gcc/x86_64-w64-mingw32/8.1.0/../../../../x86_64-w64-mingw32/bin/ld.exe: skipping incompatible C:/Users/test/Google Drive/sched/Scheduler.o when searching for C:/Users/test/Google Drive/sched/Scheduler.o

C:/BlitzMaxNG/MinGW32x64/bin/../lib/gcc/x86_64-w64-mingw32/8.1.0/../../../../x86_64-w64-mingw32/bin/ld.exe: cannot find C:/Users/test/Google Drive/sched/Scheduler.o

but the file is in the correct location (doing a 32bit build... everything works fine)


Offline Derron

  • Hero Member
  • *****
  • Posts: 1557
Re: No chances to see "?Win64" on Blitzmax NG?
« Reply #4 on: December 15, 2018, 11:32:18 PM »
Just try what happens if you execute something like this:

Code: BlitzMax
  1. SuperStrict
  2. Framework Brl.StandardIO
  3.  
  4. ?win32
  5. print "win32"
  6. ?win64
  7. print "win64"
  8. ?
  9.  

bmk makeapp -g x86 -x myfile.bmx
bmk makeapp -g x64 -x myfile.bmx

Depending on what you build it should either print win32 or win64.

bye
Ron

Offline fielder

  • Jr. Member
  • **
  • Posts: 52
Re: No chances to see "?Win64" on Blitzmax NG?
« Reply #5 on: December 16, 2018, 11:21:41 AM »
executing using the MaxIDE editor (on the Blitzmax-NG-64 archive) .. with the win64 architecture selected... (i'm working on Windows BTW)

Code: [Select]
Building untitled1
[ 77%] Processing:untitled1.bmx
[ 88%] Compiling:untitled1.bmx.gui.debug.win32.x64.c
[100%] Linking:untitled1.debug.exe
Executing:untitled1.debug.exe
win32
win64

Process complete

the Win32 section is always "processed".

Offline Derron

  • Hero Member
  • *****
  • Posts: 1557
Re: No chances to see "?Win64" on Blitzmax NG?
« Reply #6 on: December 16, 2018, 12:23:18 PM »
There are 4 conditionals for windows:
Code: BlitzMax
  1.         env.InsertDecl New TConstDecl.Create( "win32",New TIntType,New TConstExpr.Create( New TIntType,opt_platform="win32" ),0 )
  2.         env.InsertDecl New TConstDecl.Create( "win32x86",New TIntType,New TConstExpr.Create( New TIntType,opt_platform="win32" And opt_arch="x86"),0 )
  3.         env.InsertDecl New TConstDecl.Create( "win32x64",New TIntType,New TConstExpr.Create( New TIntType,(opt_platform="win64" And opt_arch="x64") Or (opt_platform="win32" And opt_arch="x64")),0 )
  4.         env.InsertDecl New TConstDecl.Create( "win64",New TIntType,New TConstExpr.Create( New TIntType,(opt_platform="win64" And opt_arch="x64") Or (opt_platform="win32" And opt_arch="x64")),0 )
  5.  

?win32 is used for "Windows" (32 or 64 bit)
?win32x86 is used when on "Windows" and targeting 32 bit
?win32x64 is used when on "Windows" and targeting 64 bit - or if opt_platform="win64" which only happens if you via "bcc -p win64".
?win64 is ... the same as ?win32x64

Conditionals are evaluated in a "if ... elseif ...elseif ...else ...endif" manner. Means a
Code: BlitzMax
  1. ?win32
  2. print "win32"
  3. ?win64
  4. print "win64
  5. ?
  6.  

is doing an "if win32 ... elseif win64 ..." thing. Once the first condition is met, the others are no longer checked.

if you wrote this instead:
Code: BlitzMax
  1. ?win32
  2. print "win32"
  3. ?
  4.  
  5. ?win64
  6. print "win64
  7. ?
  8.  

Then it becomes a "if win32 ... endif" PLUS "if win64 ... endif" thing.


So what does it mean for now:
use ?win32 if you just want to know if it is "Windows"
Use ?win32x86 if you want to check if it is 32bit Windows - and ?win32x64 for 64 bit (or ?win64).


Will create an issue for this as it is misleading.

Offline col

  • Sr. Member
  • ****
  • Posts: 407
Re: No chances to see "?Win64" on Blitzmax NG?
« Reply #7 on: December 16, 2018, 02:16:48 PM »
Even more misleading/confusing is that Win32 is actually the name of the 'Windows C/C++ API' and has nothing to do with the cpu bitness nowadays, even though ( for c/c++ ) you do have defines for WIN32 and WIN64. The Win32 API ( the functions and interfaces ) are exactly the same for 32 and 64 bit, unless you use the low level multi-thread sync functions with pointers.  :-X
Any bugs in my code are proof of its hand-coded nature.
https://github.com/davecamp

Offline Derron

  • Hero Member
  • *****
  • Posts: 1557
Re: No chances to see "?Win64" on Blitzmax NG?
« Reply #8 on: December 16, 2018, 05:43:29 PM »
Feel free to share your opinion in the issue I created today:
https://github.com/bmx-ng/bcc/issues/361


bye
Ron

Offline fielder

  • Jr. Member
  • **
  • Posts: 52
Re: No chances to see "?Win64" on Blitzmax NG?
« Reply #9 on: December 18, 2018, 08:10:31 PM »
Feel free to share your opinion in the issue I created today:
https://github.com/bmx-ng/bcc/issues/361
bye
Ron

Oh... very very thank you! finally i understand something related to NG :)