On Thursday, 2 April 2020 at 12:13:27 UTC, Adam D. Ruppe wrote:
On Thursday, 2 April 2020 at 11:29:24 UTC, burt wrote:
Anyway, I don't think this fails to work because of an error
in the d_android library. If you find anything else that may
cause it, I am glad to know, but thank you for your help.
Well, it is supposed to be a "just works" setup helper, so
anything in it is a problem! There was an off-by-one bug in the
downloader, maybe that missing byte made ldc ignore the
corrupted library file.
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]. However, when I added a
MainActivity class in D using arsd.jni, the app crashes whenever
one of the @Exported methods is called. My code looked like this:
```
import arsd.jni;
final class TextView : IJavaObject
{
mixin IJavaObjectImplementation!(false);
mixin JavaPackageId!("android.widget", "TextView");
}
mixin ImportExportImpl!TextView;
final class MainActivity : IJavaObject
{
@Export void dFunction(TextView input, TextView output,
TextView historyItem)
{
// ...
}
mixin IJavaObjectImplementation!(false);
mixin JavaPackageId!("com.mypackage.myapplication",
"MainActivity");
}
mixin ImportExportImpl!MainActivity;
```
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.
Thanks.
[0] https://github.com/ldc-developers/druntime/pull/178