[Lazarus] Bug on library project while accessing string

Darmawan Sugiarto darmawan_sugiarto at yahoo.com
Sun Jan 27 06:59:12 CET 2013


Any body had same problem with me ?

 
=============INTOSOFT============
ALEXIO CHAOS
Darmawan_Sugiarto at yahoo.com 
Yahoo Messager
=================================


________________________________
 From: Darmawan Sugiarto <darmawan_sugiarto at yahoo.com>
To: Lazarus mailing list <lazarus at lists.lazarus.freepascal.org> 
Sent: Thursday, January 24, 2013 12:57 PM
Subject: [Lazarus] Bug on library project while accessing string
 

hello guys, I got some bug on library project. When I uses Lazarus 0.9.28.2 I write this code and work well, then I recompile it use Lazarus 1.0.2 and 1.0.4 and got this error....

Project project_test raised exception class 'External: SIGEGV'.
At address 7C91B1FA


I have 2 project 

    first project is library project...
Here is the code for first project 


function test(_str:string):string; cdecl; export;


implementation

function test(_str:string):string; cdecl; export;
var
  _i,_l,_k,_d:integer;
  _h:string;
  _char:Char;
begin
  if _str<>'' then
  begin
    _l:=length(_str);
    //SetLength(_h,_l);
    _h:=_str;
   
 _char:='t';
    _h[1]:=_char;
  end else _h:='';
  Result :=_h;
end;


 Then second project is application project.
I got 1 button to execute function in the library project.
Here is the code.

  function test(_str:string):string; cdecl; external 'project1.dll' name 'TEST';

var
  Form1: TForm1;

implementation

{$R *.lfm}

{ TForm1 }

procedure TForm1.Button1Click(Sender: TObject);
begin
  ShowMessage(test('alex'));
end;   

I got that error when I click the button.
If I delete this selection, It work well
    _h[1]:=_char;


=============INTOSOFT============
ALEXIO CHAOS
Darmawan_Sugiarto at yahoo.com 
Yahoo Messager
=================================


________________________________


--
_______________________________________________
Lazarus mailing list
Lazarus at lists.lazarus.freepascal.org
http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.lazarus-ide.org/pipermail/lazarus/attachments/20130127/847b0748/attachment-0003.html>


More information about the Lazarus mailing list