//////////////// mylib.dpr /////////////// library mylib; uses myfunctions; exports foo; end. /////////////// myfunctions.pas //////////////// unit myfunctions; interface function foo(bar: integer): integer; stdcall; implementation function foo(bar: integer): integer; stdcall; begin if bar <> 0 then result := foo(bar - bar div 2) else result := bar; end; end.