OxygenBasic can be used to create general-use DLLs. You can also test them at the same time within the envelope of a single thinBasic script.
To create independent DLLs, a run-time library source needs to be embedded. I have included RTL32 with the latest thinBasic_Oxygen here in examples/DLL/
http://www.thinbasic.com/community/s...ad.php?t=12175
To expose any function, all you need to do is add export to its prototype.
The code for terminating the DLL (before the DLL is unloaded) is automatically generated.
Hello World Example
uses "oxygen"
dim src as string
src="
% filename "t.dll"
% dll
include "RTL32.inc"
function hello(byval name as string) as string, export
return "Hello "+name
end function
" 'end src
o2_basic src
if o2_errno then
msgbox 0, o2_error
stop
else
o2_exec
end if
'TEST
declare function hello lib "t.dll" alias "hello" (byval name as string) as string
msgbox 0,hello("World!")
Bookmarks