Thread never executed? lazarus / 43-Android ---------------------------------------------------------------------- Halbi1 · 2015-07-18 22:32 Hello, I am old Delphi (1 and 2) programmer and after more than a decade I found Lazarus to continue with my old project electronic interlocking for railroad modelists on Windows. The application developed on an old Windows 2000 Laptop with Lazarus 1.2.2 runs on several PCs with XP and Windows 7. Now I try to find out if my application can be ported to an android tablet or smartphone. I found the latest LazToApk 0.9.0.31, I managed to create the demo app 'project1' and it works. After these Buttons and Labels I tried to do something with a Canvas and it works. After having done a mess with the Lnet-Component I found the Synapse units and that sending Strings is a very easy thing to do, but now I have to realise a thread for receiving messages (copied and modified from Lazarus Multi threading tutorial). On Win2000 it works, but on the Android Device (Samsung S3 , Android 4.1.2) it seems that the thread method 'Execute' is never - eh - executed. Because the app don't crash I can not see any helpful information in the adb log except that the app dies. Any ideas or hints? Thanks in advance. ---------------------------------------------------------------------- Leledumbo · 2015-07-19 10:51 I see no cthreads in the uses clause. Under *nix platforms, you need cthreads because the platform doesn't provide native threading support which FPC can load automatically. See: http://wiki.lazarus.freepascal.org/Lazarus_Faq#When_I_run_a_program_wi th_threads_I_get_runtime_error_232 http://wiki.lazarus.freepascal.org/Multithreaded_Application_Tutorial# Units_needed_for_a_multi-threaded_application ---------------------------------------------------------------------- Halbi1 · 2015-07-19 14:44 Thanks to Leledumbo. In the meantime I found the hint to cthreads in a Post from greenzyzyzy http://forum.lazarus.freepascal.org/index.php/topic,28344.0.html, but it has to be placed in the use clause of the *.lpr file. In the use clause of the main unit the application crashes. Another hint I found in http://lazarus- dev.blogspot.de/2013/08/threads-with-lazarus.html: 'If you use threading in your program you should define the compiler option -dUseCThreads.' But its still the same: The procedure Execute seems to be never executed. ---------------------------------------------------------------------- Leledumbo · 2015-07-19 18:34 Quote from: Halbi1 on July 19, 2015, 04:44:38 pmThanks to Leledumbo. In the meantime I found the hint to cthreads in a Post from greenzyzyzy http://forum.lazarus.freepascal.org/index.php/topic,28344.0.html, but it has to be placed in the use clause of the *.lpr file. In the use clause of the main unit the application crashes. It's explained so in at least one of the link above. Didn't you see? Quote from: Halbi1 on July 19, 2015, 04:44:38 pmAnother hint I found in http://lazarus-dev.blogspot.de/2013/08/threads-with-lazarus.html: 'If you use threading in your program you should define the compiler option -dUseCThreads.' But its still the same: The procedure Execute seems to be never executed. No, you don't need that. It's required ONLY AND IF ONLY you use the default application project, because of the .lpr template (see yourself how it looks like).