[solved] pure library structures?

Just starting out? Need help? Post your questions and find answers here.
User avatar
idle
Always Here
Always Here
Posts: 6026
Joined: Fri Sep 21, 2007 5:52 am
Location: New Zealand

[solved] pure library structures?

Post 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
Olli
Addict
Addict
Posts: 1264
Joined: Wed May 27, 2020 12:26 pm

Re: purelibray structures?

Post 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...)
User avatar
idle
Always Here
Always Here
Posts: 6026
Joined: Fri Sep 21, 2007 5:52 am
Location: New Zealand

Re: purelibray structures?

Post 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.
Olli
Addict
Addict
Posts: 1264
Joined: Wed May 27, 2020 12:26 pm

Re: purelibray structures?

Post 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.
Fred
Administrator
Administrator
Posts: 18350
Joined: Fri May 17, 2002 4:39 pm
Location: France
Contact:

Re: purelibray structures?

Post by Fred »

Yes, you need to create the resident file in a separate call with the /RESIDENT flag.
User avatar
idle
Always Here
Always Here
Posts: 6026
Joined: Fri Sep 21, 2007 5:52 am
Location: New Zealand

Re: purelibray structures?

Post by idle »

Thanks I just expected it to do it automatically.
User avatar
idle
Always Here
Always Here
Posts: 6026
Joined: Fri Sep 21, 2007 5:52 am
Location: New Zealand

Re: purelibray structures?

Post by idle »

solved it and added to
viewtopic.php?p=632122#p632122
Post Reply