Page 1 of 1

[solved] pure library structures?

Posted: Fri Dec 13, 2024 12:21 am
by idle
how do you add structures to the library maker ?

as an example of a threaded timer why isn't the structure PB_timer added to the lib ?

Code: Select all

DisablePureLibrary timer

Prototype cbtimer(*timer)
 
Structure PB_timer 
  timeout.i
  start.i
  quit.i
  *vars
  *cb.cbtimer
  tid.i
EndStructure   
 
Procedure iTimer(*timer.PB_timer) 
  
  Repeat 
    Delay(*timer\timeout) 
    If *timer\cb  
      *timer\cb(*timer) 
    EndIf 
  Until *timer\quit 
  
  FreeMemory(*timer) 
  
EndProcedure 

ProcedureDLL timer(timeout,*vars,*callback.cbtimer)
  
  Protected *timer.Pb_timer = AllocateMemory(SizeOf(PB_timer)) 
  If *timer 
  *timer\timeout = timeout 
  *timer\vars = *vars 
  *timer\cb = *callback  
  *timer\start = ElapsedMilliseconds()
  *timer\tid = CreateThread(@iTimer(),*timer) 
  ProcedureReturn *timer
  EndIf 
EndProcedure   


pbcompilerc d:\idle\pb\junk\timer.pbi /THREAD /OPTIMIZER /PURELIBRARY /OUTPUT timer

Re: purelibray structures?

Posted: Fri Dec 13, 2024 12:55 am
by Olli
Maybe a non-sense from my person : are structures required ? If you place the structure inside the head procedure, normally all the code is covered.

And then, what it is required is the template of the procedures :

Code: Select all

name @argQty (arg1.type1, arg2.typ2, etc...)

Re: purelibray structures?

Posted: Fri Dec 13, 2024 6:23 am
by idle
Olli wrote: Fri Dec 13, 2024 12:55 am Maybe a non-sense from my person : are structures required ? If you place the structure inside the head procedure, normally all the code is covered.

And then, what it is required is the template of the procedures :

Code: Select all

name @argQty (arg1.type1, arg2.typ2, etc...)
I mean why isn't the structure automatically added to the residents since it's called. I'd expect that to be automatic.

Re: purelibray structures?

Posted: Fri Dec 13, 2024 7:55 am
by Olli
I absolute do not know. I find this resident feature interesting. But I never have had anything inside. Also, I needed 18 months to stop auto-completion.

Re: purelibray structures?

Posted: Fri Dec 13, 2024 9:06 am
by Fred
Yes, you need to create the resident file in a separate call with the /RESIDENT flag.

Re: purelibray structures?

Posted: Fri Dec 13, 2024 10:19 am
by idle
Thanks I just expected it to do it automatically.

Re: purelibray structures?

Posted: Sat Dec 14, 2024 2:30 am
by idle
solved it and added to
viewtopic.php?p=632122#p632122