Page 1 of 1

How do you make PB code into a library?

Posted: Sun Feb 05, 2006 9:40 pm
by netmaestro
without using tailbite...

Say I have this code:

Code: Select all

ProcedureDll.l CreateStandardWindow(w.l, h.l) 
   Win=OpenWindow(#PB_Any,0,0,w,h,#PB_Window_Systemmenu|#PB_Window_ScreenCentered,"Standard Window") 
   ProcedureReturn Win 
Endprocedure 


and I want to make a library command out of it so it's available to me whenever I want to use it. How is this done? How does Tailbite do it?

Posted: Sun Feb 05, 2006 10:20 pm
by va!n
i think the pb compiler will convert your code to ASM and then it will compiled to an OBJ file... the linker will link the OBJ file to the final exe.. just an idea...

Re: How do you make PB code into a library?

Posted: Mon Feb 06, 2006 9:47 am
by Rings
netmaestro wrote:without using tailbite...

Say I have this code:

Code: Select all

ProcedureDll.l CreateStandardWindow(w.l, h.l)
   Win=OpenWindow(#PB_Any,0,0,w,h,#PB_Window_Systemmenu|#PB_Window_ScreenCentered,"Standard Window")
   ProcedureReturn Win
Endprocedure
and I want to make a library command out of it so it's available to me whenever I want to use it. How is this done? How does Tailbite do it?
Tailbite comes with source, so study them :)

Posted: Mon Feb 06, 2006 9:49 am
by netmaestro
Yes, src.pack - how do I install it?

Posted: Mon Feb 06, 2006 10:07 am
by El_Choni
Pu it in the TailBite directory, then open TBManager.exe, and click on "Extract sources"

Posted: Mon Feb 06, 2006 10:17 am
by netmaestro
Ah, thanks. That's the ticket.

Posted: Mon Feb 06, 2006 7:51 pm
by jack
if don't mind tagging along a dll, you could just make a dll and a .def file and then an import lib, see viewtopic.php?t=15687
then just import the functions (PB 4)
for example

Code: Select all


ImportC "MSVCRT.LIB"
  sprintf.l(result.s,num_format.s,number.d) As "_sprintf"
  sprintq.l(number.q,result.s,radix.l) As "__ui64toa"
  atoi64.q(number.s) As "__atoi64"
EndImport

;example use
n.l
s.s
y.q
Avogadro.d=6.0221415e23
s=Space(25)        ;allocate space
sprintf(s,"%18.15e",Avogadro)
debug s
n=sprintf("","%18.15e",Avogadro) ;supply a null "" as destination, to get the character length needed to "print" to string. 
debug "number of characters required to print "+str(n)
y=atoi64("123")

Posted: Mon Feb 06, 2006 8:00 pm
by netmaestro
Thank you Jack. That's a very helpful post.

Posted: Mon Feb 06, 2006 8:28 pm
by DarkDragon
Don't try to do a Linux Tailbite, it's nearly done(just a few parts are missing).

Posted: Sun Feb 12, 2006 11:54 pm
by Shannara
DarkDragon wrote:Don't try to do a Linux Tailbite, it's nearly done(just a few parts are missing).
Only thing left would be a OSX tailbite ;)

Posted: Mon Feb 13, 2006 2:15 pm
by DarkDragon
Shannara wrote:
DarkDragon wrote:Don't try to do a Linux Tailbite, it's nearly done(just a few parts are missing).
Only thing left would be a OSX tailbite ;)
Don't know, because I don't have a mac :-S . If I would get the money from Fred I would do it.