using alias to decorate the names
o2 code
$ dll
$ FileName dll_math_o2
includepath "..\inc\"
include "RTL32.inc"
function IsInitialized alias "IsInitialized@0"() as long export
function = (1)
end function
function MathAdd alias "MathAdd@8"(N1 as long, N2 as long) as long export
function = (N1 + N2)
end function
function MathDiv alias "MathDiv@8"(N1 as long, N2 as long) as long export
function = (N1 / N2)
end function
function MathMul alias "MathMul@8"(N1 as long, N2 as long) as long export
function = (N1 * N2)
end function
function MathSub alias "MathSub@8"(N1 as long, N2 as long) as long export
function = (N1 - N2)
end function
the following FreeBasic code works as expected
FreeBasic code
#inclib "dll_math_o2"
declare function IsInitialized alias "IsInitialized" () as integer
declare function MathAdd alias "MathAdd" (byref as integer, byref as integer) as integer
declare function MathDiv alias "MathDiv" (byref as integer, byref as integer) as integer
declare function MathMul alias "MathMul" (byref as integer, byref as integer) as integer
declare function MathSub alias "MathSub" (byref as integer, byref as integer) as integer
Print IsInitialized()
Print MathMul(4,2)
Print MathDiv(4,2)
Print MathAdd(4,2)
Print MathSub(4,2)
print "press return to end ";
sleep
[edit] unsing alias to decorate the name is a bad idea, better example by Charles below this post.