D on android and d_android

burt invalid_email_address at cab.abc
Tue Apr 7 17:25:49 UTC 2020


On Tuesday, 7 April 2020 at 12:29:57 UTC, Adam D. Ruppe wrote:
> On Tuesday, 7 April 2020 at 11:45:24 UTC, burt wrote:
>> I managed to get it to compile. I had to add __bss_end__ 
>> symbol myself and set the value to the value of the `_end` 
>> symbol or it wouldn't work. A PR to the LDC druntime is wat 
>> caused the __bss_end__ symbol to be missing [0].
>
> Blargh it was supposed to just work without main() on the new 
> ldc but I only actually ran stuff with 1.19 on actual android.
>
>
>> However, when I added a MainActivity class in D using 
>> arsd.jni, the app crashes whenever one of the @Exported 
>> methods is called.
>
> What does the android studio debugger say about it? Missing 
> method or another link problem?
>
>> And a callback method for a button in Java called dFunction 
>> with the appropriate parameters. I noticed that the generated 
>> .so file didn't contain a 
>> `Java_com_mypackage_myapplication_MainActivity_dFunction` 
>> symbol. Any help on this would be appreciated.
>
> Yeah, it uses a private name and registers that in a static 
> module constructor (this allows it to support overloads more 
> easily), so that specific name not being there isn't wrong, but 
> it could be the registration function never got called again.

Error is as follows according to the logs:

java.lang.IllegalStateException: Could not execute method for 
android:onClick
         at [etc.]
Caused by: java.lang.reflect.InvocationTargetException
         at [etc.]
Caused by: java.lang.UnsatisfiedLinkError: No implementation 
found for void 
com.mypackage.myapplication.MainActivity.dFunction(android.widget.TextView, android.widget.TextView, android.widget.TextView) (tried Java_com_mypackage_myapplication_MainActivity_dFunction and Java_com_mypackage_myapplication_MainActivity_dFunction__Landroid_widget_TextView_2Landroid_widget_TextView_2Landroid_widget_TextView_2)
         at [etc.]

So yes, it cannot find the function. How can I check if the 
module constructor is actually run?



More information about the Digitalmars-d-learn mailing list