Recent

Author Topic: [SOLVED] Synaser: Can't compile my project with Synaser linked to my program.  (Read 4677 times)

Awesome Programmer

  • Sr. Member
  • ****
  • Posts: 479
  • Programming is FUN only when it works :)
    • Cool Technology
I want to use Synaser with my program for serial communication. So, I downloaded it and linked it to my project.

When I start to compile my project, I got the following syntax error message for the Synaser Library.

Error: Incompatible Type: got "ShortInt" expected "pointer."

This is error is raised within the following procedure, which is from the Synaser Library file. The line that is giving me problem is marked with arrow.

Code: [Select]
procedure TBlockSerial.Purge;
begin
  {$IFNDEF FPC}
  SerialCheck(ioctl(integer(FHandle), TCFLSH, TCIOFLUSH));  <<<======
  {$ELSE}
  SerialCheck(fpioctl(integer(FHandle), TCFLSH, TCIOFLUSH)); <<<=====
  {$ENDIF}
  FBuffer := '';
  ExceptCheck;
end;

Anyone have any idea? Thank you.
« Last Edit: May 30, 2013, 05:35:35 pm by reltek »

Rave

  • Full Member
  • ***
  • Posts: 170
Tried @integer(FHandle)?

Jurassic Pork

  • Hero Member
  • *****
  • Posts: 1290
What is the version of your synaser file. In mine (007.005.002) :
Code: [Select]
{$IFNDEF MSWINDOWS}
procedure TBlockSerial.Purge;
begin
  {$IFNDEF FPC}
  SerialCheck(ioctl(FHandle, TCFLSH, TCIOFLUSH));
  {$ELSE}
    {$IFDEF DARWIN}
    SerialCheck(fpioctl(FHandle, TCIOflush, TCIOFLUSH));
    {$ELSE}
    SerialCheck(fpioctl(FHandle, TCFLSH, Pointer(PtrInt(TCIOFLUSH))));
    {$ENDIF}
  {$ENDIF}
  FBuffer := '';
  ExceptCheck;
end;
{$ELSE}
procedure TBlockSerial.Purge;
var
  x: integer;
begin
  SetSynaError(sOK);
  x := PURGE_TXABORT or PURGE_TXCLEAR or PURGE_RXABORT or PURGE_RXCLEAR;
  if not PurgeComm(FHandle, x) then
    SerialCheck(sErr);
  FBuffer := '';
  ExceptCheck;
end;
{$ENDIF}
Jurassic computer : Sinclair ZX81 - Zilog Z80A à 3,25 MHz - RAM 1 Ko - ROM 8 Ko

Awesome Programmer

  • Sr. Member
  • ****
  • Posts: 479
  • Programming is FUN only when it works :)
    • Cool Technology
My Synaser version is 007.002.000.

Where do you download the lastest Synaser from?

Thanks.

Jurassic Pork

  • Hero Member
  • *****
  • Posts: 1290
in my component TLazSerial for linux and windows  here : http://www.lazarus.freepascal.org/index.php/topic,20481.msg118267.html#msg118267

file :   lazserial.7z

you can find the synaser.pas that i use. Depending of what you want to do , may be, you can use the component. 

Friendly , J.P
Jurassic computer : Sinclair ZX81 - Zilog Z80A à 3,25 MHz - RAM 1 Ko - ROM 8 Ko

Awesome Programmer

  • Sr. Member
  • ****
  • Posts: 479
  • Programming is FUN only when it works :)
    • Cool Technology
J.P. You are a life saver.  :D and your avatar looks  8-) too.

I love Synaser and your TLazSerial component that I am able to add my own functions and procedure as needed.

Yes, it compiles without any error.

Thanks, again.

Cheers!!! :)

 

TinyPortal © 2005-2018