Home |
Last modified: 29-05-2022 |
FreeBasic is an open-source, QuickBasic-compatible, BASIC compiler available for Windows, Linux, and MacOS. It seems less feature-rich than closed-source PureBasic and PowerBasic, but it has the advantage of being cross-platform and might be good enough for your needs. It feels like a C-like Basic so get ready for things like pointers, malloc, etc.
Two sources for help: the wiki and the forum.
The FreeBasic compiler, fbc.exe, requires the Microsoft C run-time library, msvcrt.dll.
Different files are available:
Download and unzip FreeBASIC-x.7z into c:\FreeBasic, and update Windows' PATH thusly: C:\FreeBasic\bin.
To tell FB where to find third-party folders, use the following kind of code:
To compile "Hello, world!", open a DOS box in examples\misc\, and type "fbc hello.bas". This while generate hello.exe which you can try to check that FreeBasic works fine.
If you wish, install an IDE such as FBEdit ("opensource IDE for the FreeBASIC compiler. Coded in C++ using wxWidgets library to be as portable as possible." (Last real update 2006)"), JellyFB, or Geany .
fbc.exe myfile.bas -s name , where name is either "gui" or "console".
Header files are named *.bi
https://www.freebasic.net/wiki/ProPgExecutables
Unzip files (.a, .dll) into Freebasic's \lib\win32 directory.
Basically two types of libraries: static libraries (linked into the executable and no external library is required at runtime), and import libraries + dynamic library (an import library may be linked into the executable, but the DLL is required at runtime.)
Some libraries are directly available as binaries, while others are only available as source and must be compiled before being used biwht Freebasic.
Freebasic supports two regex engines: PCRE ("Regular expression pattern matching using the same syntax as Perl"; It's available in two version: PCRE, and PCRE2) and TRE ("Lightweight, robust, and efficient POSIX compliant regexp matching library"). Examples are available in .\examples\regex\.
St_W compiled PCRE and PCRE2.
Using sprintf() from the C Standard Library Functions:
Here's how to loop through the parameters passed to a program (source):
"C:\Program Files\FreeBASIC\inc\sqlite3.bi"
#define SQLITE_VERSION "3.1.3"
Visg is supposed to be the most usable GUI designer for Freebasic. Note that it hasn't been updated since… 2008.
https://www.freebasic.net/forum/viewtopic.php?t=9035&start=0
"Dialog.bas provides a simple method of creating a dialog box template in allocated memory, and creating a modal or modeless dialog from the template"
Last updated 2015?
http://www.purebasic.fr/english/viewtopic.php?f=7&t=31678
http://en.wikipedia.org/wiki/PureBasic
"Transfers control over to an external program. When the program exits, execution resumes immediately after the call to Exec."
http://www.freebasic.net/wiki/wikka.php?wakka=KeyPgExecNote: The first parameter must contain the name of the application, with its full path, and parameters, if any, must be passed trough the second+ parameter(s). Here's an example:
result = Exec("c:\windows\notepad.exe","c:\test.txt")
"Transfers control over to an external program. When the program exits, execution will return to the system."
http://www.freebasic.net/wiki/wikka.php?wakka=KeyPgRun
"Program execution will be suspended until the command interpreter exits."
http://www.freebasic.net/wiki/wikka.php?wakka=KeyPgShell
FreeBasic doesn't include functions to build a GUI application. You'll either have to use a third-party GUI builder, or learn the Win32 API à la Petzold.
Some samples:
The options are:
Here's an example of calling the Windows API to display a message box:
Here's how to display a regular window:
Compile the source file with "-s gui". Make sure the application doesn't include a call to "Sleep", as it prevents it from closing.
To replace the standard application icon with your own:
If you want to extract an ICO from an application, BeCyIconGrabber is free and works fine.
http://www.freebasic.net/index.php/link
http://www.freebasic.net/wiki/wikka.php?wakka=FBWiki
http://www.freebasic.net/wiki/wikka.php?wakka=DocToc
http://www.freebasic.net/wiki/wikka.php?wakka=CompilerRunning
http://www.freebasic.net/arch/category.php?id=1
http://www.freebasic.net/arch/category.php?id=2
http://www.freebasic.net/index.php/codelib?section=view_code&id=12
http://www.freebasic.net/forum/viewforum.php?f=2
http://www.freebasic.net/index.php/details?page=download&category=bin&id=1
http://www.freebasic.net/index.php/details?page=download&category=doc&id=1
http://radasm.cherrytree.at/fbedit/
http://www.planetsquires.com/jellyfishpro_freebasic.htm