Reputation: 326
I am trying to compile an existing large windows (console) server application for Linux, using the Delphi 10.4 Enterprise IDE. The problem is that the moment I switch to the Linux platform, even the most 'basic' items no longer exist, and I just have no idea how and where to add them, either as Delphi units, or do I have to find libraries in the linked Linux Virtual Machine, and then Delphi will find them there?
Is there somewhere a manual or book on how this is supposed to work? Primary requirements: I need TThread (Does not exist) and I need a MS-Windows lookalike Message system for it, to communicate between the Threads and the Main thread, passing Pointers to records in memory.
Any help whatsoever is very welcome.
Upvotes: 0
Views: 940
Reputation: 12322
Here is a minimal reproducible example of a thread that works compiled for Windows or Linux with no source code change and using Delphi 10.4.2:
program LinuxThreadDemo;
{$APPTYPE CONSOLE}
{$R *.res}
uses
System.SysUtils,
System.Classes; // Contains TThread for both Windows and Linux
type
TMyThread = class(TThread)
procedure Execute; override;
end;
var
MyThread : TMyThread;
procedure TMyThread.Execute;
begin
WriteLn('Hello from thread');
end;
begin
try
MyThread := TMyThread.Create(TRUE);
try
MyThread.Start;
ReadLn;
finally
MyThread.Free;
end;
except
on E: Exception do
Writeln(E.ClassName, ': ', E.Message);
end;
end.
Upvotes: 1