Thema: Delphi How to - string in DLL

Einzelnen Beitrag anzeigen

WojTec

Registriert seit: 17. Mai 2007
480 Beiträge
 
Delphi XE6 Professional
 
#7

Re: How to - string in DLL

  Alt 19. Jun 2011, 17:49
I tested @Luckies code and it working in example, but don't work in this case:

Delphi-Quellcode:
function func1(s: PChar; Buffer: PChar; lenBuffer: Integer): Integer; external 'StringDLL.dll';

var
  Buffer: array [0..MAX_PATH] of Char;
  BufferSize: DWORD;
begin
  BufferSize := High(Buffer);
  func1('bar', Buffer, BufferSize);
  ShowMessage(Buffer);
end;
Raises AV. Windows functions working, this one not. Why?

Geändert von WojTec (19. Jun 2011 um 18:02 Uhr) Grund: Added static linked function
  Mit Zitat antworten Zitat