Sign in Join

Live chat for Free Pascal, Lazarus, Delphi and every Pascal programmer.

Mailing lists / lazarus / 2010-01

Problematic usage of TClipboard in shared library

2 messages · 1 person ·

Reply by email Subscribe to this list Your subscription

Read-only archive. Use j and k to move between messages.

Roland Turcan

Hello Lazarus mailing list!

I have written a simple tunnel library to communicate an old application with the clipboard on modern linux.
When I use my functions from test application called directly, then everything works fine.
When I use those function as external dynamic functions from shared library then no data are read and no data are written into clipboard.

I have set that library should use Gtk2, and into LPR I mentioned "Interfaces" unit.

What could be a reason, that clipboard doesn't work properly when used in shared library?

Thanks in advance.

Reply by email

Roland Turcan
to Roland Turcan

<<< 15.01.2010 13:54 - Roland Turcan "" >>>
RT> Hello Lazarus mailing list!

RT> I have written a simple tunnel library to communicate an old RT> application with the clipboard on modern linux. RT> When I use my functions from test application called directly, then RT> everything works fine.
RT> When I use those function as external dynamic functions from shared RT> library then no data are read and no data are written into clipboard.

I have checked that:

PROCEDURE clipboard_setastext (Buffer:PChar; BufferSize:INTEGER);
VAR   s       :STRING;
begin
  IF BufferSize > 0 THEN begin
    SetLength (s, BufferSize);
    StrCopy (PChar(s), Buffer);
    Clipboard.AsText := s;
    {$IFDEF DEBUG}
    StrToFile ('clipboard_setastext.Result = ' + s + #13#10 +
               'from clipboard.AsText = ' + Clipboard.AsText, '/tmp/_SetAsText.txt');
    {$ENDIF}
  END;
END;

logs into file that "s" and "Clipboard.AsText" contain the same value, but nothing could be pasted out in text editor. It means, that it is not sent into clipboard.

When I read Clipboard.AsText inside of GetAsText funcion, it always returns an empty string.

TRoland;

RT> I have set that library should use Gtk2, and into LPR I mentioned RT> "Interfaces" unit.

RT> What could be a reason, that clipboard doesn't work properly when used RT> in shared library?

RT> Thanks in advance.

Reply by email