Einzelnen Beitrag anzeigen

Benutzerbild von SirThornberry
SirThornberry
(Moderator)

Registriert seit: 23. Sep 2003
Ort: Bockwen
12.235 Beiträge
 
Delphi 2006 Professional
 
#10

AW: Class with strings in DLL

  Alt 7. Jan 2011, 17:08
If you use PChar and so you don't need Sharemem.
Zitat:
When I try use any function from it, raises AV
Do you have this Problem only if you have strings in your dll? I suppose you have source like this:
Delphi-Quellcode:
function GetString(): PChar;
var
  mystring: string;
begin
  mystring := 'hello world';
  result := myString;
end;
If you have such source code you will get an AV because PChar is only a Pointer (of a special type). But after leaving this funktion "mystring" is freed and so "result" points to freed memory.

It would be interesting if you get the AV during the call or later when you use the result.
Jens
Mit Source ist es wie mit Kunst - Hauptsache der Künstler versteht's
  Mit Zitat antworten Zitat