Code PBLibs in PB

Developed or developing a new product in PureBasic? Tell the world about it.
RValois
User
User
Posts: 16
Joined: Fri Aug 15, 2003 6:31 am
Location: Brazil
Contact:

Post by RValois »

Hi El_Choni,
Thanks for the fix, the recursive procedure is now generated correctly.
Put "src.pack" in the TailBite folder and click on the "Extract TailBite sources" button
I already tried that, for some reason only the src dir is created but no sources. I'm using WinMe.

Thanks again,
RValois.
El_Choni
TailBite Expert
TailBite Expert
Posts: 1007
Joined: Fri Apr 25, 2003 6:09 pm
Location: Spain

Post by El_Choni »

Thanks, I'll check that.
El_Choni
Dare2
Moderator
Moderator
Posts: 3321
Joined: Sat Dec 27, 2003 3:55 am
Location: Great Southern Land

Post by Dare2 »

El_Choni,

Thank you for this.

I know zero about building a PB library. I took a the code for dll I had written a while back, and "TailBit" it. Modded some program code to replace the callFunction xxx(n,args) with xxx(args). Ran it. And it worked.

I stand in awe.

Whilst I still know zero about building PB libraries, I now can build them. Or more accurately, I can give TailBite some code and it will build them.

Many, many thanks again. :)
El_Choni
TailBite Expert
TailBite Expert
Posts: 1007
Joined: Fri Apr 25, 2003 6:09 pm
Location: Spain

Post by El_Choni »

Thanks for all the feedback, it helps a lot.

Regards,
El_Choni
El_Choni
TailBite Expert
TailBite Expert
Posts: 1007
Joined: Fri Apr 25, 2003 6:09 pm
Location: Spain

Post by El_Choni »

El_Choni
ricardo
Addict
Addict
Posts: 2438
Joined: Fri Apr 25, 2003 7:06 pm
Location: Argentina

Post by ricardo »

Hi El_Choni,

Im trying to make as small lib from a procedure i find here in the forums (cant remember who code it! :( )

Code: Select all

ProcedureDLL.s xxGetWebPage(URL.s) ; Get a web Page 
    OpenType = 1
    isLoop.b=1 
    INET_RELOAD.l = $80000000 
    hInet.l=0 
    hURL.l=0 
    Bytes.l=0 
    Buffer.s=Space(2048) 
    res.s="" 
    
    hInet = InternetOpen_("PB@INET", OpenType, #NULL, #NULL, 0) 
    hURL = InternetOpenUrl_(hInet, URL, #NULL, 0, INET_RELOAD, 0) 
    
    Repeat 
      Delay(0)
      InternetReadFile_(hURL,@Buffer, Len(Buffer), @Bytes) 
      If Bytes = 0 
        isLoop=0 
      Else 
        Delay(0)
        res = res + Left(Buffer, Bytes) 
      EndIf 
    Until isLoop=0 
    
    InternetCloseHandle_(hURL) 
    InternetCloseHandle_(hInet) 
    ProcedureReturn res 
  EndProcedure 
Now, when the lib is mades, if i try to call it from a code i get an error telling this:

TBTemp\Function .text: undefined reference to 'GetWebPage_S2'

GetWebPage is the name of the lib.

What im doing wrong?
ARGENTINA WORLD CHAMPION
El_Choni
TailBite Expert
TailBite Expert
Posts: 1007
Joined: Fri Apr 25, 2003 6:09 pm
Location: Spain

Post by El_Choni »

You're doing fine, lol. It was a bug, TailBite took "PB@INET" for an API function. Fixed now, thanks a lot.
El_Choni
User avatar
einander
Enthusiast
Enthusiast
Posts: 744
Joined: Thu Jun 26, 2003 2:09 am
Location: Spain (Galicia)

Post by einander »

@El_Choni:
Thanks for TailBite! I'm amazed!

To make PB libs with TB is a breeze.
Nice!

Einander
_______
TailBite is a very powerful tool; will be good some place to upload libraries, where PB gurus can evaluate and comment them, because for sure in a few days everybody and his dog will be making his own libs.
Dare2
Moderator
Moderator
Posts: 3321
Joined: Sat Dec 27, 2003 3:55 am
Location: Great Southern Land

Post by Dare2 »

einander wrote:.. because for sure in a few days everybody and his dog will be making his own libs
And we'll all calling our functions the same names. *Visualising 40,000 libraries with NOT() and SGN()*

Maybe we'll end up needing a standards committee :D because TailBite just made it all too easy.
User avatar
Paul
PureBasic Expert
PureBasic Expert
Posts: 1282
Joined: Fri Apr 25, 2003 4:34 pm
Location: Canada
Contact:

Post by Paul »

That has already happened :(

Just convert the samples that come with TailBite and you will see they conflict with Danilo's TooBar lib.

With no set naming convention, there will be conflicting and broken libraries all over the place.
Image Image
El_Choni
TailBite Expert
TailBite Expert
Posts: 1007
Joined: Fri Apr 25, 2003 6:09 pm
Location: Spain

Post by El_Choni »

Oops! I'll change that, thanks, Paul.

EDIT: Paul, I don't find the conflicting function, could you tell me which is it to change its name?

About a naming convention, it would be good. But I don't have any idea myself on how it should be done (I think this has been discussed before with no result?).
El_Choni
Dare2
Moderator
Moderator
Posts: 3321
Joined: Sat Dec 27, 2003 3:55 am
Location: Great Southern Land

Post by Dare2 »

Bit of a tough one, that.

I think I'll make mine unique by starting with the letter "Y":

yNOT( :evil: )
yTRY( :roll: )
yFRONT( 8O )
yBOTHER(zzZZzz)

[EDIT]
El Choni, I think there is a conflict with myPaintBoxGadget and the PureTools.
[/EDIT]

lol @ Iria (below) - but yNOT?
Last edited by Dare2 on Wed Feb 25, 2004 4:27 pm, edited 2 times in total.
Iria
User
User
Posts: 43
Joined: Sat Nov 29, 2003 8:49 pm

Nice work El_Choni

Post by Iria »

First up, nice work on the old Tailbite 8)

As for naming conventions, before you know it we'll be using namespace conventions :)

purebasic.tailbite.iria.libx.linux.say.hello.function

:lol:

Seriously though it would be nice for some such explicit namespace definitions in PB :)

Ill keep watching this space until someone says Tailbite is good to go until then good luck everyone :D
El_Choni
TailBite Expert
TailBite Expert
Posts: 1007
Joined: Fri Apr 25, 2003 6:09 pm
Location: Spain

Post by El_Choni »

Yep, something like you say, but with underscores (no kidding). For example:

El_Choni_SQLite_MyFunction()

It looks ugly, but it avoids conflicts, doesn't it?

As for TailBite, I want to change the TBManager IDE a bit and, apart from bugs that will, of course, appear, it's almost ready to upload to Paul's and Andre's sites.

EDIT: I've reinstalled Danilo's PureTools and TBPro and compiled the MyPaintBoxGadget example, no conflicts. Just in case, I've changed a structure name in TB_GadgetExtension.res and suffixed all sample functions with EC_. Can somebody else check if it's ok now?
El_Choni
User avatar
Paul
PureBasic Expert
PureBasic Expert
Posts: 1282
Joined: Fri Apr 25, 2003 4:34 pm
Location: Canada
Contact:

Post by Paul »

The conflict is with your "myMDITest" example. You have a procedure called CreateTB(), which is also a command from the ToolbarPro library.

It's a good example of how easy it is to create libs and procedure that conflict ;)
Image Image
Post Reply