tobjc30c.pp 514 B

12345678910111213141516171819202122232425262728293031
  1. { %target=darwin }
  2. { %cpu=powerpc,powerpc64,i386,x86_64,arm }
  3. { Written by Jonas Maebe in 2009, released into the Public Domain }
  4. {$mode objfpc}
  5. {$modeswitch objectivec1}
  6. uses
  7. uobjc30c;
  8. type
  9. tla = objcclass(NSObject)
  10. function mytest(const c: shortstring): longint; message 'mystest:';
  11. end;
  12. function tla.mytest(const c: shortstring): longint;
  13. begin
  14. halt(1);
  15. result:=-1;
  16. end;
  17. var
  18. a: id;
  19. begin
  20. a:=ta.alloc.init;
  21. ta(a).field:=123;
  22. if (a.mytest('c')<>123) then
  23. halt(2);
  24. a.release
  25. end.