Skip to content

Commit 00dee35

Browse files
committed
Set argtypes and restype for __android_log_write
Configured ctypes argument and return types for liblog.__android_log_write to ensure correct interaction with the native Android logging library.
1 parent 9d8530b commit 00dee35

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

src/serious_python_android/lib/src/cpython.dart

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,9 +33,11 @@ import logging,sys
3333
if not getattr(sys, "__serious_python_logcat_configured__", False):
3434
sys.__serious_python_logcat_configured__ = True
3535
36-
from ctypes import cdll
36+
from ctypes import cdll, c_int, c_char_p
3737
liblog = cdll.LoadLibrary("liblog.so")
3838
ANDROID_LOG_INFO = 4
39+
liblog.__android_log_write.argtypes = [c_int, c_char_p, c_char_p]
40+
liblog.__android_log_write.restype = c_int
3941
4042
def _log_to_logcat(msg, level=ANDROID_LOG_INFO):
4143
if not msg:

0 commit comments

Comments
 (0)