Günaydın. Android native kodlamayı test ediyorum. Şimdi A.Studio için NDK HelloJNI örneğine bakarak delphide console projesinde .so build etdim.
Edit: Çözüldü
1. hello isimli console projesi oluşturdum ve örnek bu kodları yazdım. Sadece compile etdim .so kütüphane üretmesi için.
2. Bir FMX projesi oluşturdum. Project->Deployment bölümüne libhello.so ekeldim. Dosya yolu library\lib\armeabi-v7a\
Edit: Çözüldü
1. hello isimli console projesi oluşturdum ve örnek bu kodları yazdım. Sadece compile etdim .so kütüphane üretmesi için.
library hello; // burada program yazıyor onu library yapın function getYear: Integer; cdecl; begin Result := 2017; end; exports getYear name 'getYear'; begin end.
2. Bir FMX projesi oluşturdum. Project->Deployment bölümüne libhello.so ekeldim. Dosya yolu library\lib\armeabi-v7a\
uses System.IOUtils; var Path: string; FLib: THandle; getYear: function: Integer; cdecl; procedure loadLib(const name: string); begin Path := IncludeTrailingPathDelimiter(TPath.GetLibraryPath); FLib := LoadLibrary(PChar(Path + 'lib' + name + '.so')); end; procedure TMain.Button1Click(Sender: TObject); begin loadLib('hello'); // libhello.so if FLib <> 0 then begin getYear := GetProcAddress(Flib, 'getYear'); ShowMessage(IntToStr(getYear())); end; end;