Ooops
July 26, 2021, 14:20:04

Author Topic: GetVersion() in BlitzMaxNG  (Read 101 times)

Offline Midimaster

  • Sr. Member
  • ****
  • Posts: 329
    • Midimaster Music Education Software
GetVersion() in BlitzMaxNG
« on: June 29, 2021, 10:51:06 »
I actually transfer education software from BlitzMax 1.51 to BlitzMax NG.

I nearly had no problems, but one function looks like working no more:

Code: BlitzMax
  1. ?Win32
  2.         Extern "win32"
  3.            Function GetVersion:Int()
  4.         End Extern
  5. ?
  6. .....
  7.  
  8.         Function DiesesOs%()
  9.                 ?MacOs
  10.                         Return 0
  11.                 ?Win32
  12.                         Return (GetVersion() & $f)*10  + ((GetVersion() Shr 8) & $f)
  13.                 ?
  14.         End Function
  15. ?

Error Message is:
Code: [Select]
In file included from C:/BasicNG/LernProgramme/Auris/.bmx/Auris.bmx.gui.debug.win32.x64.c:1:
C:/BasicNG/LernProgramme/Auris/.bmx/Auris.bmx.gui.debug.win32.x64.h:1080:25: error: conflicting types for 'GetVersion'
 extern BBINT __stdcall  GetVersion();
                         ^~~~~~~~~~
In file included from C:/BlitzMaxNG/MinGW32x64/x86_64-w64-mingw32/include/winbase.h:36,
                 from C:/BlitzMaxNG/MinGW32x64/x86_64-w64-mingw32/include/windows.h:70,
                 from C:/BlitzMaxNG/mod/brl.mod/blitz.mod/blitz_thread.h:11,
                 from C:/BlitzMaxNG/mod/brl.mod/blitz.mod/blitz.h:28,
                 from C:/BlitzMaxNG/mod/brl.mod/blitz.mod/.bmx/blitz.bmx.debug.win32.x64.h:4,
                 from C:/BasicNG/LernProgramme/Auris/.bmx/Auris.bmx.gui.debug.win32.x64.h:4,
                 from C:/BasicNG/LernProgramme/Auris/.bmx/Auris.bmx.gui.debug.win32.x64.c:1:
C:/BlitzMaxNG/MinGW32x64/x86_64-w64-mingw32/include/sysinfoapi.h:47:27: note: previous declaration of 'GetVersion' was here
   WINBASEAPI DWORD WINAPI GetVersion (VOID);
                           ^~~~~~~~~~
Build Error: failed to compile (1) C:/BasicNG/LernProgramme/Auris/.bmx/Auris.bmx.gui.debug.win32.x64.c

Can somebody please explain, what happened?
See my current project on PlayStore: 20Tracks-Audio-Player https://play.google.com/store/apps/details?id=midimaster.twentytrackd

Offline Derron

  • Hero Member
  • *****
  • Posts: 3613
Re: GetVersion() in BlitzMaxNG
« Reply #1 on: June 29, 2021, 11:49:01 »
There is already a GetVersion() defined and you try to redefine it.

you need to "redefine" it more properly now.


untested:
Code: BlitzMax
  1. ?Win32
  2.         Extern "win32"
  3. 'original definition:    WINBASEAPI DWORD WINAPI GetVersion (VOID);
  4.            Function GetVersion:Int()="DWORD GetVersion()!"
  5.         End Extern
  6. ?
  7.  

WINBASEAPI and WINAPI should be left out - return value, function name and params would be what has to be written in the quotation marks. The "!" exclamation mark makes it "more important" :)


bye
Ron

Offline Midimaster

  • Sr. Member
  • ****
  • Posts: 329
    • Midimaster Music Education Software
Re: GetVersion() in BlitzMaxNG
« Reply #2 on: June 29, 2021, 13:38:08 »
Thanks a lot Derron!

I do not understand your solution, but it works.
See my current project on PlayStore: 20Tracks-Audio-Player https://play.google.com/store/apps/details?id=midimaster.twentytrackd

 

SimplePortal 2.3.6 © 2008-2014, SimplePortal