Forum > General

[SOLVED] Thread => AlwaysWaitForExecute ?

<< < (3/4) > >>

User137:
Well, i only tackled the most obvious mistake on start method. Second thing that is unknown to me is how Lazarus handles on the case here where there is 2 TApplications and 2 mainforms. According to those errors, not so well  :P

Just to clarify the calling order:

--- Code: ---MainProc;
// ->
procedure MainProc;
var
  frm: Ttest;
begin
  fpgApplication.Initialize;
  try
    testloadlib('/home/fred/testgraphiclib/libtestgraphic.so') ;
    TestThread := TTestThread.Create(true) ;
    TestThread.start(); // Lets change it to start()
    frm := Ttest.Create(nil);
    fpgApplication.MainForm := frm;
    frm.Show;
    fpgApplication.Run;
    // Jump to program execution and threads, and resume here when application terminates
  finally
    frm.Free;
  end;
end;

procedure TTestThread.execute();
begin
  mainproctest();
  // -> jump to mainproctest, alias of a second mainproc
end;

procedure MainProc; cdecl;
var
  frm: Ttestlib;
begin
  fpgApplication.Initialize;
  try
    frm := Ttestlib.Create(nil);
    fpgApplication.MainForm := frm;
    frm.Show;
    fpgApplication.Run;
  finally
    frm.Free;
  end;
end;
--- End code ---

Fred vS:

--- Quote ---Who loaded the lib that contains the proc that you called in your test thread, the test thread itself or the main thread?
--- End quote ---


--- Quote ---Just to clarify the calling order:
--- End quote ---

In example it is the main thread who =>

1) Load dynamically the library
2) Create the thread.
3) Do thread.execute => the thread.execute procedure is the main procedure exported in library.
4) Create his own form.

In attachment the great challenge of this winter
(need fpGUI package) =>

1) Compile (with -fPIC parameter) the library => graout.pas

2) Compile and Run progfpgui_graout.pas

All is permised => using TThread, TProcess, direct access, ...
And the Winner will be the one who can show the 2 forms working...

The Winner will get the Nobel Price of FPC too.

Fre:D


Fred vS:

--- Quote ---In attachment the great challenge of this winter
(need fpGUI package) =>
--- End quote ---

No Nobel Price this winter ?

(LCL and other widgets may challenge too  ;) )

Fred.

PS : Dont say "it is impossible" => Impossible is not a fpc word.

User137:
Have you tried googling on "delphi form in dll"? Maybe it is what you are after, but alot has been already written about it.

Fred vS:

--- Quote ---Have you tried googling on "delphi form in dll"?
--- End quote ---

Yep,  User137, many thanks to answer.

Hum, no i did not try this  :-X

Now it is done and , indeed, lot of things to find but all are taking about Modal forms (and that is not difficult to do).
The challenge is to have a "no-modal form in dll" and there... big silence...

But, step by step, i am sure that the challenge will be done...

Many thanks.

Navigation

[0] Message Index

[#] Next page

[*] Previous page

Go to full version