Page 1 of 1

[Done]Problem with static and PB 520 beta 5/6

Posted: Sat Jul 13, 2013 5:41 pm
by mpz
Hello,

i found a problem with the function static and PB 5.20 Windows. In the procedure the static variabe is not set to "extrn". I hope you find a solution:

Code: Select all

ProcedureDLL  Mytest (Var)
  
  Static *pointer
  
  If Not *pointer 
    *pointer = 10
  EndIf
  ProcedureReturn var + *pointer
EndProcedure


error undefinite_symbol

as code

Code: Select all

format MS COFF

Public PB_Mytest

section '.text' code readable executable

PB_Mytest:
PUSH   ebx
PS0=8
;
; Static *pointer
;
; If Not *pointer
CMP    dword [so_Mytest.p_pointer],0  <- error

it is missing

Code: Select all

extrn so_Mytest.p_pointer


i hope this helps to solve the problem...

Greeting Michael

Re: Problem with static and PB 520 beta 5

Posted: Sun Jul 14, 2013 8:16 pm
by Bisonte
The helpfile of tailbite :
Note on using STATIC keyword : The static keyword is not supported by tailbite. (The generated PureBasicStart routine is not evaluated.)
Please use a Global variable instead and initialize it in the Init function.

Re: Problem with static and PB 520 beta 5

Posted: Sun Jul 14, 2013 9:36 pm
by mpz
Hi Bisonte,

i use static since 3 years with tailbite and PB and it woks fine. I think it is only a little think for changing. If it is not possible i will test it with global...

Greetings Michael

Re: Problem with static and PB 520 beta 5

Posted: Mon Jul 15, 2013 5:13 pm
by ABBKlaus
Know issues wrote:- The use of the Static keyword is limited to basic types : Byte,Word,Long,Integer,Quad,Double
You can´t use Strings / Dim() as they allocate memory in a different place of code that TailBite is not parsing
It was totally legal until PB5.20 came out :twisted:

I´ll try to fix it :shock:

Re: Problem with static and PB 520 beta 5

Posted: Mon Jul 15, 2013 6:46 pm
by ABBKlaus
I found out that static objects got renamed to "so_" in older Versions it was "s_". I added it to the List of VarAliases in TailBite_Res.pb.

It might not be the last Change to be found.

Here´s the download : http://www.tailbite.com/downloads/TailBiteV1.4.10.zip

BR Klaus

Re: Problem with static and PB 520 beta 5

Posted: Tue Jul 16, 2013 1:39 pm
by mpz
Hello ABBKlaus,

i tested it with Windows XP, my (monster) code and PB 5.20 Beta 5 and it works fine. Tomorrow i will test it with Windows 7 and PB 5.2 x86 and x64...

*P.S.: tested with Windows 7 x86 and x64, works fine

Much thanks
Michael