Code PBLibs in PB

Developed or developing a new product in PureBasic? Tell the world about it.
El_Choni
TailBite Expert
TailBite Expert
Posts: 1007
Joined: Fri Apr 25, 2003 6:09 pm
Location: Spain

Post by El_Choni »

You can download the new Beta at:

http://www.terra.es/personal5/temporald ... taller.exe

The only difference with the previous version (apart from some bugfixing) is that globals and arrays work now. Please report any bugs including some code, if possible. I hope the next build I upload is a nearly-finished version, there are still some features to add. Thanks,

IMPORTANT: Arrays and lists can only be used and/or declared INSIDE the procedures. Any code outside the procedures is (and will be) ignored, except for: includefile/xincludefile, datasections and the data/labels/includebinaries inside them, global/structures/interfaces declarations.
El_Choni
Justin
Addict
Addict
Posts: 948
Joined: Sat Apr 26, 2003 2:49 pm

Post by Justin »

Just tried the new version, when i try to make a lib with the included test lib, the previous error does not appear but now hangs on Creating function listing.. and after a while Tailbite crashes.

Running XP SP1 , PB last version.
El_Choni
TailBite Expert
TailBite Expert
Posts: 1007
Joined: Fri Apr 25, 2003 6:09 pm
Location: Spain

Post by El_Choni »

The only sample which should work is "prueba2.pb", I´m using the others for debugging. Anyway, I think it´s better to test with your own code, the current samples suck a bit.
El_Choni
Manne
User
User
Posts: 30
Joined: Mon Apr 28, 2003 8:49 pm

Post by Manne »

@El_Choni

Is there a chance to get this version via mail?
By clicking the provided URL i get always redirected to http://81.211.105.11/.

manuela008@swissinfo.org

Manne
Justin
Addict
Addict
Posts: 948
Joined: Sat Apr 26, 2003 2:49 pm

Post by Justin »

OK, prueba2 works, i'll try to test with my own code. Btw, is it possible to execute some code when the lib is loaded and on program exit?, something like coinitialize_()/couninitialize_().
scurrier
Enthusiast
Enthusiast
Posts: 169
Joined: Sat May 03, 2003 4:10 am

Post by scurrier »

Manne wrote:@El_Choni

Is there a chance to get this version via mail?
By clicking the provided URL i get always redirected to http://81.211.105.11/.

manuela008@swissinfo.org

Manne
go get spybot search and destroy you have a hijacker on your computer
Manne
User
User
Posts: 30
Joined: Mon Apr 28, 2003 8:49 pm

Post by Manne »

@scurrier

Thanks for the tip, but Spybot and Adaware found nothing.
So i had a deeper look in my system and found a couple of redirections in my "hosts" file.
I've cleaned it up and now all works correctly.:wink:

Manne
freedimension
Enthusiast
Enthusiast
Posts: 613
Joined: Tue May 06, 2003 2:50 pm
Location: Germany
Contact:

Post by freedimension »

And you're not worried about the fact that some dumba.. was (or even still is) executing some strange code changing your host file? I would be very upset. Go get a Personal Firewall and a Virus Scanner.
Manne
User
User
Posts: 30
Joined: Mon Apr 28, 2003 8:49 pm

Post by Manne »

@freedimension

For sure i'm using a good fw and av protection.
But as we can see there are still some leaks, nothing is perfect. :wink:

Manne
scurrier
Enthusiast
Enthusiast
Posts: 169
Joined: Sat May 03, 2003 4:10 am

Post by scurrier »

people that write this crap should be sent to jail or shot!!!
i rebuilt my computer and by the time i went and downloaded spyware and ran it i had 6 or so spywares on my machine, this is getting out of control i did find anouther program called hijack this that works good but you need to know what your installed program are or you could delete something your not suppose to
scurrier
Enthusiast
Enthusiast
Posts: 169
Joined: Sat May 03, 2003 4:10 am

Post by scurrier »

is there any help file with this i can't seem to get it to work
i make my program in a DLL format and i don't know how to make a desc file and it keeps getting errors about file not found. do i need to compile under pb first or doe's it need to be ASM code only i can't figure this out for the life of me can someone help. I can send the source code if needed
Denis
Enthusiast
Enthusiast
Posts: 778
Joined: Fri Apr 25, 2003 5:10 pm
Location: Doubs - France

Post by Denis »

Hi El_Choni

i try the new version, and now the Global var works Ok if we put it in the first ProcedureDll.

I get some asm erreur when i use Goto instruction.

Try this example:

Code: Select all

ProcedureDLL MakeTests()

For i = 0 To 10
Next

If i > 10
   Goto Over10
Else
   Goto Ten
EndIf

Over10:
MessageRequester(" Exemple", "Over 10", #PB_MessageRequester_Ok | #MB_ICONQUESTION)

Goto Fin

Ten:
MessageRequester(" Exemple", "10", #PB_MessageRequester_Ok | #MB_ICONQUESTION)

Fin:
End
EndProcedure
If you check for errors, PB report no errors.

If you make a lib, you get a FASM errors msg like that :
Exemple_l_over10:
error, symbol already defined
I've taking a look to the asm code and the problem is that TB generate this 3 declarations lines for the 3 GOTO :

Code: Select all

Extrn Examples_l_over10
Extrn Examples_l_ten
Extrn Examples_l_fin
and it generate correctly this 3 labels and the corresponding JMP

Code: Select all

Examples_l_over10:
Examples_l_ten:
Examples_l_fin:
If you put a simple label without Goto, the declaration line for this label is not generated by TB.


In an another example, i put asm JMP instead of Goto and i get this error :

PB code :

Code: Select all

ProcedureDLL MakeTests()
#MB_ICONQUESTION = 32
For i = 0 To 10
Next

If i > 10

   !JMP    l_over10
Else
   !JMP    l_Ten
EndIf

! l_over10:
MessageRequester(" Exemple", "Over 10", #PB_MessageRequester_Ok | #MB_ICONQUESTION)

Goto Fin

! l_Ten:

MessageRequester(" Exemple", "10", #PB_MessageRequester_Ok | #MB_ICONQUESTION)

Fin:
End
EndProcedure
Checking PB test and all is OK and when i make a lib, i get this FASM msg :
Exemple_l_over10:
error, invalid argument
The asm generated code has this declarations for the JMP

Code: Select all

Extrn Examples_l_over10
Extrn Examples_l_Ten
Extrn Examples_l_over10:   <-- this line generate the asm error
Extrn Examples_l_Ten:
As you could see, there is 2 Extrn lines for the asm labels, on with ':' at the end and the other one witout.

I select command lines options :
Prompt comfirm on deletion of previous ... and
Keep sources files after ....

The first time i try to create the lib (and after it was the same), i get the msg

Exemples user library already exist bla bla

In fact, the lib doesn't exist at first. And because FASM report an errors, the lib was never created.

Did i do something wrong ?


Thanks for yor work El_Choni.

I have a question :
Did you put an option to create an InitFunction and a EndFunction for the lib?


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

Post by El_Choni »

Init and End functions are planned for final release. Thanks for the extensive bug report, it´ll help a lot in debugging.

Regards,
El_Choni
Justin
Addict
Addict
Posts: 948
Joined: Sat Apr 26, 2003 2:49 pm

Post by Justin »

Great, init/end will be pretty useful for example to get a pointer to a com object, use it inside the lib as a global and then release it on program exit, i hope it can be done. excellent tool, thanks.
El_Choni
TailBite Expert
TailBite Expert
Posts: 1007
Joined: Fri Apr 25, 2003 6:09 pm
Location: Spain

Post by El_Choni »

@scurrier: sorry, didn´t have too much time to reply yesterday. You only need to put your code in a ProcedureDLL (for exported functions). Then select TailBite in the Tools menu, and relaunch PureBasic in order to test your function.

@Manne: sent.

EDIT: added support for InitFunction and EndFunction through "_Init" and "_End" procedure suffixes. These procedures can´t have arguments, nor procedurereturns. Fixed label problem (I think).

Regards,
El_Choni
Post Reply