[Lazarus] Problematic usage of TClipboard in shared library
Roland Turcan
konf at rotursoft.sk
Fri Jan 15 14:10:43 CET 2010
<<< 15.01.2010 13:54 - Roland Turcan "konf at rotursoft.sk" >>>
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.
--
Best regards, TRoland
http://www.rotursoft.sk
http://exekutor.rotursoft.sk
More information about the Lazarus
mailing list