FreeBasic Bare Bones: Difference between revisions

Jump to navigation Jump to search
[unchecked revision][unchecked revision]
Content deleted Content added
Combuster (talk | contribs)
Dumped a Freebasic hello world barebones, further explanations to follow.
 
Combuster (talk | contribs)
Line 84: Line 84:


== Tuning FreeBasic for OS Development ==
== Tuning FreeBasic for OS Development ==
A normal install of FreeBasic is in most cases configured to build for the system it was installed on. That means that it will try to compile programs for linux or windows OSes, rather than your own.
'''TODO''' (You need a binutils >= 2.17, and some hacking at FB binaries. You can build the entire [[GCC Cross-Compiler]] for completeness sake and for when you need to do the Runtime)

To fix this, you should build at the very least a [[GCC Cross-Compiler|crosscompiling binutils]] (2.17 or later recommended). While you're at it, you can also build GCC, which comes in handy once you start porting software written in C (that includes the runtime).

FreeBasic stores its auxiliary binaries in the bin directory, or a subdirectory thereof. To get started quickly, replace <code>ld</code>, <code>ar</code> and <code>as</code> with the versions built in the previous step. Note that this stops FreeBasic from working on its previous host.
Under windows, the bin directory is subdivided into platforms, and you can add a new one rather than modifying the existing one. To use this, create the 'linux' directory, copy <code>i586-elf-ld</code>, <code>i586-elf-ar</code> and <code>i586-elf-as</code>, and rename them to <code>ld</code>, <code>ar</code> and <code>as</code>. When running freebasic you can use the <code>-t linux</code> command line switch to compile for your OS instead of windows, allowing you to continue using Freebasic normally for non-os development.

'''TODO: Verify statements for 32-bit and 64-bit linux'''


== The code ==
== The code ==