Hi
Can't use tcsetattr function. Lazarus compiles but raises runtime error 'Access violation' after some error messages. Same code has no problem with Kylix3oe.
Here is my unit, simplified to be clear. Use '/dev/ttyS0' as PortName.
unit tcom;
{$mode objfpc}{$H+}
interface
uses
Classes, SysUtils, LibC;
var
CommId : integer;
function InitCom(PortName: string): boolean;
implementation
function InitCom(PortName: string):boolean;
var
ATermios : TTermios;
begin
Result := false;
CommID := FileOpen(PortName, O_RDWR or O_NOCTTY or O_NDELAY);
fcntl(CommID, F_SETFL, 0);
tcgetattr(CommID, ATermios);
tcsetattr(CommID, TCSANOW, ATermios);
Result := true;
end;
end.
Problem is on tcsetattr line.