HOME

TheInfoList



OR:

PureBasic is a commercially distributed procedural computer
programming language A programming language is a system of notation for writing computer programs. Programming languages are described in terms of their Syntax (programming languages), syntax (form) and semantics (computer science), semantics (meaning), usually def ...
and
integrated development environment An integrated development environment (IDE) is a Application software, software application that provides comprehensive facilities for software development. An IDE normally consists of at least a source-code editor, build automation tools, an ...
based on
BASIC Basic or BASIC may refer to: Science and technology * BASIC, a computer programming language * Basic (chemistry), having the properties of a base * Basic access authentication, in HTTP Entertainment * Basic (film), ''Basic'' (film), a 2003 film ...
and developed by Fantaisie Software for
Windows Windows is a Product lining, product line of Proprietary software, proprietary graphical user interface, graphical operating systems developed and marketed by Microsoft. It is grouped into families and subfamilies that cater to particular sec ...
,
Linux Linux ( ) is a family of open source Unix-like operating systems based on the Linux kernel, an kernel (operating system), operating system kernel first released on September 17, 1991, by Linus Torvalds. Linux is typically package manager, pac ...
,
macOS macOS, previously OS X and originally Mac OS X, is a Unix, Unix-based operating system developed and marketed by Apple Inc., Apple since 2001. It is the current operating system for Apple's Mac (computer), Mac computers. With ...
and
Raspberry Pi Raspberry Pi ( ) is a series of small single-board computers (SBCs) developed in the United Kingdom by the Raspberry Pi Foundation in collaboration with Broadcom Inc., Broadcom. To commercialize the product and support its growing demand, the ...
. An
Amiga Amiga is a family of personal computers produced by Commodore International, Commodore from 1985 until the company's bankruptcy in 1994, with production by others afterward. The original model is one of a number of mid-1980s computers with 16-b ...
version is available, although it has been discontinued and some parts of it are released as open-source. The first public release of PureBasic for Windows was on 17 December 2000. It has been continually updated ever since. PureBasic has a "lifetime license model". As cited on the website, the first PureBasic user (who registered in 1998) still has free access to new updates and this is not going to change.FAQ
lifetime licence details
PureBasic compiles directly to
IA-32 IA-32 (short for "Intel Architecture, 32-bit", commonly called ''i386'') is the 32-bit version of the x86 instruction set architecture, designed by Intel and first implemented in the i386, 80386 microprocessor in 1985. IA-32 is the first incarn ...
,
x86-64 x86-64 (also known as x64, x86_64, AMD64, and Intel 64) is a 64-bit extension of the x86 instruction set architecture, instruction set. It was announced in 1999 and first available in the AMD Opteron family in 2003. It introduces two new ope ...
,
PowerPC PowerPC (with the backronym Performance Optimization With Enhanced RISC – Performance Computing, sometimes abbreviated as PPC) is a reduced instruction set computer (RISC) instruction set architecture (ISA) created by the 1991 Apple Inc., App ...
or 680x0 instruction sets, generating small standalone
executable In computer science, executable code, an executable file, or an executable program, sometimes simply referred to as an executable or binary, causes a computer "to perform indicated tasks according to encoded instruction (computer science), in ...
s and DLLs which need no runtime libraries beyond the standard system libraries. Programs developed without using the platform-specific
application programming interface An application programming interface (API) is a connection between computers or between computer programs. It is a type of software Interface (computing), interface, offering a service to other pieces of software. A document or standard that des ...
s (APIs) can be built easily from the same source file with little or no modification. PureBasic supports
inline assembly In computer programming, an inline assembler is a feature of some compilers that allows low-level code written in assembly language to be embedded within a program, among code that otherwise has been compiled from a higher-level language such as ...
, allowing the developer to include
FASM FASM (''flat assembler'') is an assembler for x86 processors. It supports Intel-style assembly language on the IA-32 and x86-64 computer architectures. It claims high speed, size optimizations, operating system (OS) portability, and macro abi ...
assembler commands within PureBasic source code, while using the variables declared in PureBasic source code, enabling experienced programmers to improve the speed of speed-critical sections of code. PureBasic supports and has integrated the
OGRE An ogre (feminine: ogress) is a legendary monster depicted as a large, hideous, man-like being that eats ordinary human beings, especially infants and children. Ogres frequently feature in mythology, folklore, and fiction throughout the world ...
3D Environment. Other 3D environments such as the
Irrlicht Engine Irrlicht (pronounced in German) is an open-source game engine written in C++. It is cross-platform, officially running on Windows, macOS, Linux and Windows CE and due to its open nature ports to other systems are available, including FreeBSD, X ...
are unofficially supported. Since version 6.00 (June 2022), in addition to compilation using ASM, PureBasic offers compilation with a C backend. This enables access to new platforms (e.g. Raspberry) and should make it easier to add new libraries in the future.


Programming language


Characteristics

PureBasic is a native cross platform 32 bit and 64 bit BASIC compiler. Currently supported systems are Windows, Linux, macOS. The AmigaOS version is legacy and open-source. The compiler produces native executables and the syntax of PureBasic is simple and straightforward, comparable to plain C without the brackets and with native unicode string handling and a large library of built-in support functions.PureBasic home page
/ref> It can compile console applications,
/ref> GUI applications,
/ref> and DLL files.
/ref>


Hello World example

The following single line of PureBasic code will create a standalone x86 executable (4.5 KiB (4,608 bytes) on Windows version) that displays a message box with the text " Hello World". MessageRequester("Message Box", "Hello World") And the following variant of the same code, which instead uses an inline
Windows API The Windows API, informally WinAPI, is the foundational application programming interface (API) that allows a computer program to access the features of the Microsoft Windows operating system in which the program is running. Programs can acces ...
call with no need for declarations or other external references, will create an even smaller 2.0 KiB (2,048 bytes) standalone x86 executable for Windows. MessageBox_(0, "Hello World", "Message Box", 0) The following is a console version of the Hello World example. OpenConsole() ; Open a console window. Print("Hello, World!") Delay(5000) ; Pause for 5 seconds


Procedural programming

PureBasic is a "Second generation BASIC" language, with structured conditionals and loops, and procedure-oriented programming supported. The user is not required to use procedures, so a programmer may opt for a coding style which includes , and . Below is a sample procedure for sorting an array, although SortArray is now a built-in function of PureBasic. Procedure bubbleSort(Array a(1)) Protected i, itemCount, hasChanged itemCount = ArraySize(a()) Repeat hasChanged = #False itemCount - 1 For i = 0 To itemCount If a(i) > a(i + 1) Swap a(i), a(i + 1) hasChanged = #True EndIf Next Until hasChanged = #False EndProcedure Below is a sample program that displays a sizeable text editor with two menu items. ;Create Window: OpenWindow(0, #PB_Ignore, #PB_Ignore, 800, 600, "Simple Text Editor", #PB_Window_SystemMenu , #PB_Window_MinimizeGadget , #PB_Window_MaximizeGadget , #PB_Window_SizeGadget) ;Add 2 menus: CreateMenu(0, WindowID(0)) MenuItem(1, "&OK") MenuItem(2, "&Cancel") ;Add Editor: EditorGadget(0, 0, 0, 0, 0) SetGadgetFont(0, LoadFont(0, "Courier New", 10)) ;Process window messages until closed: Repeat Select WaitWindowEvent() Case #PB_Event_Menu Select EventMenu() Case 1: MessageRequester("OK clicked directly or with '&' mnemonic.", GetGadgetText(0)) Case 2: Break EndSelect Case #PB_Event_SizeWindow: ResizeGadget(0, 0, 0, WindowWidth(0, #PB_Window_InnerCoordinate), WindowHeight(0, #PB_Window_InnerCoordinate)) Case #PB_Event_CloseWindow: Break EndSelect ForEver PureBasic does not escape double quotes in strings so these must be concatenated with .


Object-oriented programming

Fred, the developer of PureBasic, has stated that PureBasic will never be
object oriented Object-oriented programming (OOP) is a programming paradigm based on the concept of '' objects''. Objects can contain data (called fields, attributes or properties) and have actions they can perform (called procedures or methods and impleme ...
.PureBasic won't be object oriented
/ref> However, numerous users have created object oriented support systems.PureObject: PureBasic OOP support
/ref>OOP tutorial
/ref>Another OOP PreCompiler
/ref>


Data types

Variable data type specified when you first use it (and optionally - in the future), and is separated from the name of the point. There is a set of basic types - (float and double numbers), (integers - from single-byte and 8-byte), - strings. * used to count the length of a string will not exceed the first
null character The null character is a control character with the value zero. Many character sets include a code point for a null character including Unicode (Universal Coded Character Set), ASCII (ISO/IEC 646), Baudot, ITA2 codes, the C0 control code, and EB ...
(). In addition to basic types, the user can define the type of construction via Structure type_name field_name.type ; Single field. Perhaps the structures attachment. field_name ounttype ; Static arrays. ; ... ; Optional construction StructureUnion .. EndStructureUnion allows you ; to combine multiple fields into one area of memory ; that is sometimes required for the conversion types. StructureUnion type_name.type ; ... EndStructureUnion EndStructure Variables can be single (actually, standard variables),
dynamic array In computer science, a dynamic array, growable array, resizable array, dynamic table, mutable array, or array list is a random access, variable-size list data structure that allows elements to be added or removed. It is supplied with standard l ...
(declared using the , a
linked list In computer science, a linked list is a linear collection of data elements whose order is not given by their physical placement in memory. Instead, each element points to the next. It is a data structure consisting of a collection of nodes whi ...
(), an
associative array In computer science, an associative array, key-value store, map, symbol table, or dictionary is an abstract data type that stores a collection of (key, value) pairs, such that each possible key appears at most once in the collection. In math ...
(in new versions of language) ()


Form Designer RAD

PureBasic has its own form designer to aid in the creation of forms for applications, but other third-party solutions are also available.PureVision
Professional form design for PureBASIC.
ProGUI
DLL library comprising more than 100 well documented commands to quickly incorporate rich, customizable GUI components into your applications.
The original non-integrated ''Visual Designer'' was replaced with a new integrated ''Form Designer'' on 14 Feb 2013.PureBasic 5.10 is released
/ref>


User community

PureBasic provides an online forum for users to ask questions and share knowledge. On 17 february 2025 the English language forum had 6,484 members and contained 70,174 threads comprising 578,646 posts since 17 May 2002.English forum
Official forum.
Numerous code sharing sites show PureBasic is used to create tools
/ref> and games in a fast and easy way,PureArea
/ref> and share large amounts of open-source code.
/ref>


Further reading

*
This book is now freely downloadable
*


References


General references

* * * * *


External links

*
Official Purebasic Forums (English)

PureBasic Team Blog
- Official Blog "Random thoughts on PureBasic development" ;Articles *
PureBasic - The Perfect Cross-Platform & Native Development Language
(2015) ;Libraries and Open Source Code Archives *

{{DEFAULTSORT:Purebasic 1998 software BASIC compilers BASIC programming language family High-level programming languages Integrated development environments Linux integrated development environments MacOS programming tools Procedural programming languages Programming languages Programming languages created in 1998 User interface builders Windows integrated development environments