diff options
Diffstat (limited to 'xmake/templates/pascal/shared/src')
| -rw-r--r-- | xmake/templates/pascal/shared/src/foo.pas | 19 | ||||
| -rw-r--r-- | xmake/templates/pascal/shared/src/main.pas | 13 |
2 files changed, 32 insertions, 0 deletions
diff --git a/xmake/templates/pascal/shared/src/foo.pas b/xmake/templates/pascal/shared/src/foo.pas new file mode 100644 index 000000000..788950f46 --- /dev/null +++ b/xmake/templates/pascal/shared/src/foo.pas @@ -0,0 +1,19 @@ +library foo; + +{$mode objfpc}{$H+} + +function fib(n : Int64) : Int64; cdecl; +begin + if n > 1 then + begin + Result := fib(n - 1) + fib(n - 2); + end + else + Result := 1; +end; + +exports + fib; +end. + + diff --git a/xmake/templates/pascal/shared/src/main.pas b/xmake/templates/pascal/shared/src/main.pas new file mode 100644 index 000000000..02d5e88d0 --- /dev/null +++ b/xmake/templates/pascal/shared/src/main.pas @@ -0,0 +1,13 @@ +program hello; + +function fib(n: Int64): Int64; + cdecl; external 'foo'; + +var + Value: Integer; +begin + Value := 5; + WriteLn(fib(Value)); +end. + + |
