PureBasic topology and options

Just starting out? Need help? Post your questions and find answers here.
Anubis
New User
New User
Posts: 6
Joined: Fri Jun 03, 2005 11:32 am
Location: California - USA

PureBasic topology and options

Post by Anubis »

I'm new to PureBasic, but not BASIC programming itself. :wink:

I have read a few things on each of these items but I still cannot get a solid OVERALL understanding of when, why and how to use/create the following items. So here goes my question.

The following items are best used and created by....

PureBasic: Used for General coding, with over 600+ commands. OK

Libraries? When is it best to use instead of PB code. How do you create?

ASM? Machine Language. When is it best to use instead of PB code. How do you create? Within PB (Inline ASM?)

API? Windows based calls, helps extend power of PB but limited to Windows? Found the API Reference. :shock:

Wrappers? Term to describe a LIB? coded for PB or PB command itself to call an OS function. :?:

Any help in better laying out the when, why and how to each of these (and any others I may have overlooked).

Libraries being my biggest question, since I see many references in posts, such as SQLite needing a LIB for PB to use. Than additional requests for the programmer of the LIB to update it. Sounds fun and difficult at the same time.

OK I can accept that, but why a LIB and how do you development it (tools needed?), not to mention when do you need a LIB.

Any and all help is appriciated. Thank you all in advance.

MR. NEWBIE :D
/\NUBIS
Dreglor
Enthusiast
Enthusiast
Posts: 759
Joined: Sat Aug 02, 2003 11:22 pm
Location: OR, USA

Post by Dreglor »

Libraries, I use them when i can't do somthing in purebasic already or thru api's

ASM, I hardly use it and when i do it when I want to do somthing low level like check cpu id also i don't write asm my self.
Asm it self is pretty platform indepentand the only thing you have to worry about is specific cpu intructions that are only on certain cpu's like amds 3dnow and intels sse2

API, i use api-guide to find the functions and how they are used

wrappers, the term used here means to write code for every function for Purebasic when you can't import PB directly or when it to complex for some users. like ogre all (or most) functions are ported to a easier pb like syntax and we can't import it directly
~Dreglor
Tommeh
Enthusiast
Enthusiast
Posts: 149
Joined: Sun Aug 29, 2004 2:25 pm
Location: United Kingdom

Post by Tommeh »

Libraries: When you download purebasic there is a SDK folder for help in creating libraries. But thanks to tailbite you can make the libs in PureBASIC but you can normally make them in assembly or c so even if PureBASIC dosnt have that little feature that c does, you can create your c source code into a library (examples again in the library sdk)

Assembly: Its best to use if you want very fast and very optimized code, you can just write a procedure in asm for example if you were going to use that procedure a lot, it would help speed things up :) but to use inline asm all you do is put a ! in front of it and use the asm command. e.g:

Code: Select all

!MOV eax,3
debug "hello world"
API: Advanced Programmer Interface, this is not just for windows but its mostly refered to on windows systems as WinAPI, the calls you make for windows e.g. MessageBoxA_() will not work on linux because its a windows API but there is linux API (don't know any off hand :)) but in PB its easy to call API, just add a underscore after the API command and treat like a procedure: Beep_(freq, duration)

Wrappers: Basicly your just wrapping already done code in other code to make it easy to use, yeah for example ogre :) the dll for that is very complex to use but its wrapped in a PureBASIC library to make it easy to use and more user friendly (Basicly somebody else does the hard :))

Remember PureBASIC is a lot different from most BASIC languages you will soon pick it up quickly

Hope that helped :)
thefool
Always Here
Always Here
Posts: 5875
Joined: Sat Aug 30, 2003 5:58 pm
Location: Denmark

Post by thefool »

unless you mean libraries in form of DLL files. The dll's can be used by other programs and as plugins! So you can make an plugin architecture that allows other users to write DLL's that then will be intergrated in your program.
Anubis
New User
New User
Posts: 6
Joined: Fri Jun 03, 2005 11:32 am
Location: California - USA

Post by Anubis »

Thank you for the help guys!

PureBasic\Library SDK... cannot believe I did not see that! :roll:

Lots of goodies in there. ASM and C needed to create, ouch! I will certainly look into Tailbite.

Tommeh, I love the fact that you can code ASM right along with standard PB code.

I do believe I understand now where each of these items fits in the grand scheme of the PB world.

Of course now I have one last question, thanks to THEFOOL... :lol:

LIB and DLL are the same? LIB being specific only to PB whereas DLL can be used by other languages as well? Do I got this right? :wink:

I would tend to think that I want to stay with standalone EXE that do not need Registry entries (Windows). Is this even possible if a LIB is needed to help PB talk to something like SQLite (maybe not a Beginner question).

PB has come to me quite easily so far and I have ported a few programs of mine from other BASICs!

THANK YOU FRED & TEAM for such a great product. :D
/\NUBIS
Post Reply