diff options
| author | ruki <[email protected]> | 2026-02-28 21:55:13 +0800 |
|---|---|---|
| committer | ruki <[email protected]> | 2026-02-28 21:55:13 +0800 |
| commit | 5280c9480cb0d7d3ab55d516e296152ec273e14a (patch) | |
| tree | af041546121010fdad5639c231ad2b2a4900aa12 /xmake/templates/pascal/shared/src | |
| parent | 71e10b70334401d46c47f574c8f46fcd20ccf818 (diff) | |
rewrite templates
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. + + |
