BASIC

Author Topic: GLBasic 15.004 bug and solution  (Read 237 times)

Offline hardyx

  • Community Developer
  • Dr. Type
  • ******
  • Posts: 479
    • View Profile
GLBasic 15.004 bug and solution
« on: 2017-Oct-13 »
I have GLBasic v15 and works ok, but I can't update to version 15.005, the update works but the version remains in 15.004. I don't know if the next error is fixed in the 15.005 update. This can be related with this other post: http://www.glbasic.com/forum/index.php?topic=11066.0

The bug occurs compiling a TYPE in my code. It's normal code not using inline C++.

Code: GLBasic [Select]
// type with some functions
TYPE Dialogos
        FUNCTION Iniciar:
            // some code...
        ENDFUNCTION
        // more functions...
ENDTYPE
 

Code: GLBasic [Select]
*** Configuration: WIN32 ***
precompiling:
GPC - GLBasic Precompiler V.14.721
Wordcount:877 commands
compiling:
In file included from C:\Users\FJMONT~1\AppData\Local\Temp\glbasic\gpc_temp0.cpp:1:
C:\Users\FJMONT~1\AppData\Local\Temp\glbasic\gpc_temp.h: In constructor `__GLBASIC__::Dialogos::Dialogos()':
C:\Users\FJMONT~1\AppData\Local\Temp\glbasic\gpc_temp.h:54: error: expected identifier before '{' token
C:\Users\FJMONT~1\AppData\Local\Temp\glbasic\gpc_temp.h:54: error: expected `(' before '{' token

(Many error lines like the last three....)
 

Looking at the generated code (gpc_temp.h) I can see the compiling error:

Code: GLBasic [Select]
class Dialogos
{
GLB_DECLARE_TYPE_DEBUGGER;
public:
        // some code here ...
        Dialogos(): // <--- this is bad

        {
                GLB_IMPLEMENT_TYPE_DEBUGGER;
        }
        // more code here...
 }
 

The generated code fails because the ":" should not be there. This happens because my TYPE have not any member variables in it. If I put a dummy variable in the TYPE like this, the code compiles and links Ok. This "patch" must be done in each TYPE that does not have variables.

Code: GLBasic [Select]
TYPE Dialogos
        dummy% // fix glb15 fail

        // class with some functions and no variables
        FUNCTION Iniciar:
            // some code...
        ENDFUNCTION
        // more functions...
ENDTYPE
 

The generated code is good now and compiles without errors:
Code: GLBasic [Select]
class Dialogos
{
GLB_DECLARE_TYPE_DEBUGGER;
public:
        Dialogos(): // <-- this is ok now
                 REGISTER_MEMBER_DEF(dummy,0)

        {
                GLB_IMPLEMENT_TYPE_DEBUGGER;
        }
}
 

I hope this can be fixed.
« Last Edit: 2017-Oct-13 by hardyx »

Offline hardyx

  • Community Developer
  • Dr. Type
  • ******
  • Posts: 479
    • View Profile
Re: GLBasic 15.004 bug and solution
« Reply #1 on: 2017-Oct-19 »
No replies :'(  :'(

Offline erico

  • Community Developer
  • Prof. Inline
  • ******
  • Posts: 4056
    • View Profile
    • Portfolio
Re: GLBasic 15.004 bug and solution
« Reply #2 on: 2017-Oct-19 »
Hi hardyx,
I´d like to help but the level of the problem you seem to have is beyond my skills.

Offline Schranz0r

  • Premium User :)
  • Administrator
  • Prof. Inline
  • *******
  • Posts: 4953
  • O Rly?
    • View Profile
Re: GLBasic 15.004 bug and solution
« Reply #3 on: 2017-Oct-20 »
Never run into this error :D

My Types start normal with variables and then Functions  :x
So, is this a bug or a feature? ;)
I <3 DGArray's :D

PC:
AMD RYzen 7 1700 @3.9Ghz, 16GB HyperX Fury 2600Mhz Ram, HIS 7970 GHz Edition @3GB, Windows 10 Pro 64Bit, MSi Tomahawk B350 Mainboard

Offline hardyx

  • Community Developer
  • Dr. Type
  • ******
  • Posts: 479
    • View Profile
Re: GLBasic 15.004 bug and solution
« Reply #4 on: 2017-Oct-22 »
I have some utility TYPES that doesn't have variables, others are normal types.
Putting a dummy variable works ok, but it's an error in the code generation.

Enviado desde mi SM-A310F mediante Tapatalk


Offline Kitty Hello

  • code monkey
  • Administrator
  • Prof. Inline
  • *******
  • Posts: 10649
  • here on my island the sea says 'hello'
    • View Profile
    • http://www.glbasic.com
Re: GLBasic 15.004 bug and solution
« Reply #5 on: 2017-Oct-26 »
Fixed in next update.

Offline hardyx

  • Community Developer
  • Dr. Type
  • ******
  • Posts: 479
    • View Profile
Re: GLBasic 15.004 bug and solution
« Reply #6 on: 2017-Oct-26 »
Thank you Gernot!!! :good: