You need:
http://www.freebasic.net/index.php/about
IDE FBIDE:
http://fbide.freebasic.net/
Here are a couple Free Basic Code Examples for creating a DLL.
A messagebox created with a sub-routine:
Code: Select all
#include once "windows.bi"
Extern "Windows-MS"
sub msgBox Alias "msgBox"(byval msg as string, byval title as string) Export
MessageBox( null, msg, title, MB_OK )
End sub
end extern
Code: Select all
Extern "Windows-MS"
Function add2 Alias "add2"(byval x as integer,byval y as integer) As Integer export
function = x+y
End Function
end extern
Some things that tripped me up:
Alias "your_function_name" statement - prevents name mangling - do not forget this or you won't be able to call from ZGE.
The default calling convention is stdcall. If you do not use <Extern> and <end extern> - You won't be able to call it from ZGE.
Export is a necessary keyword when exporting a DLL.
To compile a DLL - you can use the IDE or use a command promt.
From the IDE:
In the Fbide menu view-settings, Click on the freebasic tab. This shows you compiler options. You will see a default Compiler command that looks like this:
Code: Select all
*<$fbc>* *<$file>*
Code: Select all
*<$fbc>* -dll *<$file>*
Here are the examples with zge project files - add2 example only outputs to the log window.