Advertisement
Guest User

Untitled

a guest
Jun 14th, 2018
66
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Pascal 1.54 KB | None | 0 0
  1. program dll_support;
  2.  
  3. uses dynlibs;
  4.  
  5. const
  6.   STRING_NO_ERR = 0;    //Ошибки отсутствуют;
  7.     STRING_ERR_NULL = -1;   //Ошибка выделения памяти;
  8.     STRING_ERR_DATA = -2; //Некорректные входные параметры;
  9.  
  10. function STRING_new(hand: Pointer; buff: PChar): integer; stdcall; external 'dll_string';
  11. {function str_off(a: integer): integer; stdcall; external 'dll_string';
  12. function str_set(a: integer): integer; stdcall; external 'dll_string';
  13. function str_cpy(a: integer): integer; stdcall; external 'dll_string';
  14. function str_sub(a: integer): integer; stdcall; external 'dll_string';
  15. function str_cat(a: integer): integer; stdcall; external 'dll_string';
  16. function str_add(a: integer): integer; stdcall; external 'dll_string';
  17. function str_cpm(a: integer): integer; stdcall; external 'dll_string';
  18. function str_get(a: integer): integer; stdcall; external 'dll_string';
  19. function str_len(a: integer): integer; stdcall; external 'dll_string';
  20. function str_out(a: integer): integer; stdcall; external 'dll_string';
  21. function str_cnt(a: integer): integer; stdcall; external 'dll_string';  }
  22.  
  23. type
  24.   p_t_hand = ^t_hand;
  25.   t_hand = ^t_head;
  26.   t_head = record
  27.     dat: PChar;
  28.     count: integer;
  29.   end;
  30.  
  31.  { TMyFunc = function(a: integer): integer; stdcall;     }
  32.  
  33. var
  34.   {res: integer;
  35.   test_func: TMyFunc;
  36.   hand: TLibHandle;     }
  37.   hand: t_hand;
  38.   err: byte;
  39.   buff: PChar;
  40. begin
  41.   hand := nil;
  42.   err := STRING_new(@hand, 'hello');
  43.   writeln(err);
  44.   writeln(hand^.dat);
  45.     readln;
  46. end.
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement