Just starting out? Need help? Post your questions and find answers here.
idle
Always Here
Posts: 6026 Joined: Fri Sep 21, 2007 5:52 am
Location: New Zealand
Post
by idle » Fri Dec 13, 2024 12:21 am
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
Posts: 1266 Joined: Wed May 27, 2020 12:26 pm
Post
by Olli » 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...)
idle
Always Here
Posts: 6026 Joined: Fri Sep 21, 2007 5:52 am
Location: New Zealand
Post
by idle » Fri Dec 13, 2024 6:23 am
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
Posts: 1266 Joined: Wed May 27, 2020 12:26 pm
Post
by Olli » Fri Dec 13, 2024 7:55 am
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
Posts: 18350 Joined: Fri May 17, 2002 4:39 pm
Location: France
Contact:
Post
by Fred » Fri Dec 13, 2024 9:06 am
Yes, you need to create the resident file in a separate call with the /RESIDENT flag.
idle
Always Here
Posts: 6026 Joined: Fri Sep 21, 2007 5:52 am
Location: New Zealand
Post
by idle » Fri Dec 13, 2024 10:19 am
Thanks I just expected it to do it automatically.
idle
Always Here
Posts: 6026 Joined: Fri Sep 21, 2007 5:52 am
Location: New Zealand
Post
by idle » Sat Dec 14, 2024 2:30 am