[Lazarus] android: debugln and thread
Benito van der Zander
benito at benibela.de
Thu May 9 15:00:28 CEST 2013
>
> I don't know for sure what the cause could be, but: do you use FPC
> 2.5.1 or 2.7.1?
2.7.1
> I suppose you are talking about native code and LCL-CustomDrawn in
> Android, correct?
mostly.
(CustomDrawn has so many bugs, so I made the GUI in java instead and
call the Pascal
functions with JNI to do the calculations...)
> Try using
> __android_log_write directly instead of DebugLn to be 100% sure.
Surprisingly that one works fine...
Benit
On 05/09/2013 12:09 PM, Felipe Monteiro de Carvalho wrote:
> I suppose you are talking about native code and LCL-CustomDrawn in
> Android, correct?
>
> The source code for DebugLn in Android is located in
> lcl/interfaces/customdrawn/customdrawnobject_android.inc
>
> procedure TCDWidgetSet.AndroidDebugLn(ASender: TObject; AStr: string;
> var AHandled: Boolean;
> Target: TLazLoggerWriteTarget; Data: Pointer);
> begin
> AHandled := Target in [lwtStdOut, lwtStdErr];
> if not AHandled then exit;
> __android_log_write(ANDROID_LOG_INFO, 'lclapp', PChar(AccumulatedStr+AStr));
> AccumulatedStr := '';
> end;
>
> So I suppose that FPC threading breaks __android_log_write. Try using
> __android_log_write directly instead of DebugLn to be 100% sure.
> Notice that __android_log_write is a NDK function, it is part of the
> Android NDK released by Google, it is not our code.
>
> Try asking in the android-ndk Google Groups about the problem. Google
> engineers there helped me with problems.
>
> One idea would be to try to see if creating a thread using pthreads
> directly would also break __android_log_write... I never created a
> thread this way, so I have no idea how to do it, but Google shows many
> pthreads tutorials. I suppose that Android uses pthreads, but could be
> wrong.
>
More information about the Lazarus
mailing list