the example used is the examples\dll\mydll, for convenience I post the code here.
mydll.bi
Code: Select all
declare function AddNumbers alias "AddNumbers"( byval a as integer, byval b as integer ) as integer
Code: Select all
#include once "mydll.bi"
function AddNumbers( byval a as integer, byval b as integer) as integer export
function = a + b
end function
Code: Select all
#include "mydll.bi"
#inclib "mydll"
randomize( timer( ) )
dim as integer x = rnd( ) * 10
dim as integer y = rnd( ) * 10
print x; " +"; y; " ="; AddNumbers( x, y )
sleep
unfortunately no optimization doesn't always work, see viewtopic.php?p=244853#p244853fbc -asm intel -O 0 -lib mydll.bas
fbc -asm intel -O 2 test.bas
OK
fbc -asm intel -O 1 -lib mydll.bas
fbc -asm intel -O 2 test.bas
ld.exe: Cannot export H: symbol not found
fbc -asm intel -O 2 -lib mydll.bas
fbc -asm intel -O 2 test.bas
Warning: .drectve `H?A' unrecognized
fbc -asm intel -O 3 -lib mydll.bas
fbc -asm intel -O 2 test.bas
Warning: .drectve `H?A' unrecognized
fbc -asm intel -O s -lib mydll.bas
fbc -asm intel -O 2 test.bas
OK
fbc -asm intel -O fast -lib mydll.bas
fbc -asm intel -O 2 test.bas
OK
also when compiling using the gcc toolchain, I get a segfault when running the test, no matter what optimization level was used when compiling the lib.