summary refs log tree commit diff stats
path: root/examples/cross_calculator/lazarus/unit1.pas
diff options
context:
space:
mode:
authorAraq <rumpf_a@web.de>2012-09-08 15:39:37 -0700
committerAraq <rumpf_a@web.de>2012-09-08 15:39:37 -0700
commit9c63d12cef05709c79ce6d0f6b0cffd0f2243fe7 (patch)
tree5403ed6c16295dca3cd6f60971e0e40583e64af7 /examples/cross_calculator/lazarus/unit1.pas
parent4cd795b3eefce8fad3a933848455e677b2e2c67b (diff)
parentf6e7aebbd9a7185b3c45f2734636090c0efd2b2b (diff)
downloadNim-9c63d12cef05709c79ce6d0f6b0cffd0f2243fe7.tar.gz
Merge pull request #199 from gradha/implement_cross_platform_example
Implement cross platform example
Diffstat (limited to 'examples/cross_calculator/lazarus/unit1.pas')
-rwxr-xr-xexamples/cross_calculator/lazarus/unit1.pas58
1 files changed, 58 insertions, 0 deletions
diff --git a/examples/cross_calculator/lazarus/unit1.pas b/examples/cross_calculator/lazarus/unit1.pas
new file mode 100755
index 000000000..aa0ef6cf7
--- /dev/null
+++ b/examples/cross_calculator/lazarus/unit1.pas
@@ -0,0 +1,58 @@
+unit Unit1; 
+
+{$mode objfpc}{$H+}
+
+interface
+
+uses
+  Classes, SysUtils, FileUtil, LResources, Forms, Controls, Graphics, Dialogs,
+  Spin, StdCtrls;
+
+type
+
+  { TForm1 }
+
+  TForm1 = class(TForm)
+    Edit1: TEdit;
+    Label1: TLabel;
+    SpinEdit1: TSpinEdit;
+    SpinEdit2: TSpinEdit;
+    procedure FormCreate(Sender: TObject);
+    procedure SpinEdit1Change(Sender: TObject);
+  private
+    { private declarations }
+  public
+    { public declarations }
+  end; 
+
+var
+  Form1: TForm1; 
+
+implementation
+
+{ TForm1 }
+
+{$link nimcache/lib/system.o}
+{$link nimcache/backend.o}
+{$link nimcache/nim__dat.o}
+{$linklib c}
+
+procedure NimMain; cdecl; external;
+function myAdd(x, y: longint): longint; cdecl; external;
+
+procedure TForm1.FormCreate(Sender: TObject);
+begin
+  // we initialize the Nimrod data structures here:
+  NimMain();
+end;
+
+procedure TForm1.SpinEdit1Change(Sender: TObject);
+begin
+  Edit1.text := IntToStr(myAdd(SpinEdit1.Value, SpinEdit2.Value));
+end;
+
+initialization
+  {$I unit1.lrs}
+
+end.
+